Hello,
Is there a way to publish with python a feature service that is not hosted (in my sde)?
Thank you.
Not entirely sure how to interpret you question. When you mention "not hosted" I assumed that the data will not reside in the portal, but in the explanation below you state "not hosted (in my sde)". Can you clarify what your data source is (where does the data reside now) and where you want to publish the layer (ArcGIS Online or Portal)?
Hi,
I am building a script in python 3 and plan to run it from pro, the script in his first part will publish serval hosted feature layer to portal 10.5.1 and that is o.k. I have 4 more layers the sit in one project and will publish as one service they are taken from our enterprise geodatabase inside Microsoft sql server.
I want to publish those layers as regular services for the server and not as hosted in the portal. But I couldn't find the way to do it from Arcpy for python 3 modules .
Thank you.
There are no plans for ArcGIS Pro to enable publishing to Server. See this link Questions and Answers | 2017 Esri User Conference
Is there a plan to allow publishing of services from ArcGIS Pro directly to ArcGIS Server?
No. The introduction of ArcGIS Enterprise, which integrates Portal for ArcGIS, signifies a shift from the client-server pattern to a Web GIS pattern that takes full advantage of the geoinformation model. A key design concept of Web GIS systems – such as ArcGIS Online or ArcGIS Enterprise - is organizing a collection of items in a portal. Accessing this portal from any device, anywhere, at any time allows you to use, create, and share geographic information throughout your organization, the community, and openly on the web. This information includes items like maps, scenes, layers, analytics, and apps. ArcGIS Server on its own is not capable of integrating into this model without the additional capabilities and content management functionality provided through a portal. For many of today’s advanced GIS service types, including vector tile layers, feature layers, and more, the service by itself does not contain all the information used to style or describe the results. Instead some of this information is part of the corresponding portal item, which gives more flexibility for modifying or changing content on-the-fly instead of going through the full publishing workflow.ArcGIS Server is a crucial component of ArcGIS Enterprise and can be thought of as the engine behind the scenes, but it does not stand alone in the modern GIS.
Also have a close look at the discussion related to this idea: https://community.esri.com/ideas/12258 . Especially the comments made by dlaw-esristaff
Hello Xander,
Thanks for the answers, a follow-up question. I want to publish with python a service that will reffer to the data in the enterprise geodatabase, Pro can do that and when you do manually it does not upload an .sd file to the portal and does not write "feature layer (hosted)" in the type field of my content, it only write "feature layer".
How can I do the same thing (not uploading the .sd and not get the (hosted)) with python 3 or ArcGIS API for python.
Thank you again.
Hi,
Did you find an answer to your question?
I am also trying to figure this out...
Seems strange that there are things that can be done with the ArcGIS Pro UI manually, but can not be done with arcpy.
Were you able to resolve this issue? I have the same need to publish regular feature layers, that do not show up as hosted.
Hi Matthew,
Yes, eventually I found this page:
MapServiceDraft—Sharing module | ArcGIS Desktop
Check the sample code "Modify SDDraft example".
I am able to publish a Feature Service that uses referenced data from a enterprise geodatabase (not hosted) with:
doc = DOM.parse(sddraft_output_filename)
typeNames = doc.getElementsByTagName('TypeName')
for typeName in typeNames:
if typeName.firstChild.data == "FeatureServer":
extension = typeName.parentNode
for extElement in extension.childNodes:
if extElement.tagName == 'Enabled':
extElement.firstChild.data = 'true'
f = open(sddraft_mod_xml_file, 'w')
doc.writexml(f)
f.close()
arcpy.StageService_server(sddraft_mod_xml_file, sd_output_filename)
arcpy.UploadServiceDefinition_server(sd_output_filename, ags)
I hope it is helpful.
/Torbjörn
Since this is a Discussion rather than a question, we can't mark a correct answer. At the time this was posted, it was not possible to publish to a standalone server from ArcGIS Pro. At Pro 2.3 (January 2019) this became possible with map services through Python only (no UI) and at ArcGIS Pro 2.4 (June 2019) the rest of the service types were added along with the UI.
See Publish a map service—ArcGIS Pro | ArcGIS Desktop and related help.