Add overwrite table to arcpy

1016
8
10-25-2022 11:32 AM
Status: Already Offered
Labels (1)
RonnieRichards
Occasional Contributor III

Please add methods to ArcGIS Pro arcpy to support the Overwrite Table functionality. For some reason this exists only as a command in ArcGIS Pro but not in arcpy. 

https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/overwrite-standalone-table.htm

We have a number of hosted tables in ArcGIS Online exposed to Open Data which originated from the Enterprise Geodatabase. At this time these updates have to be performed by the user using Pro's sharing options and we cannot automate the overwrite table service updates due to the lack of arcpy capability. 

Having tables automated will help us fully automate updating the hosted services. Adding the publishing of stand alone tables was the first step, now please help us automate this.

Thanks for your consideration

8 Comments
JonahLay

Hi @RonnieRichards,

It is actually possible to overwrite a hosted table using ArcPy. You'll need to modify the overwriteExistingService property of the sharing draft. See this help topic for more information: https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/featuresharingdraft-class.htm

Please let me know if this works for you.

Thanks,

Jonah

 

RandyCasey

@RonnieRichards you are correct, arcpy has no functionality for Hosted Services. You have to use the ArcGIS API for Python: ArcGIS API for Python, if you want to be able to access ArcGIS Online or Enterprise Hosted features. I found this article: How To: Overwrite hosted feature services from ArcGIS Pro to ArcGIS Online using Python (esri.com), to be particularly useful when I needed to automate the update of a feature service that we are hosting on our Portal.   

RonnieRichards

Thank you both! I will review these and see what is different with our current process. We are having challenges with our existing feature layer script breaking in the publish method when sourced as a table. 

HannesZiegler
Status changed to: Needs Clarification

@RonnieRichards thank you for submitting your idea. Seeing that there are already two implementations for this, I'm marking this one as "Needs Verification". That means it is closed for further kudos until we have received clarification whether these two implementations satisfy your original request.

Thanks!

RonnieRichards

Thanks again for the information and one of the solutions references is  using the arcpy library to create the service draft. The other is using FeatureSharingDraft which we will have to look into but why can;t these be treated the same as feature classes? 

I went thru our publishing products and our tables SD drafts are failing with arcpy method arcpy.mp.CreateWebLayerSDDraft.

This is how all of our Enterprise GDB sourced datasets are being published to AGOL and the reason for this idea for table support in arcpy CreateWebLayerSDDraft.

 

JonahLay

@RonnieRichards CreateWebLayerSDDraft is an older function which the arcpy.sharing module now replaces. Can you refer to this sample code on publishing a table? The script publishes both a layer and table in your map, but it should work for tables by themselves too.

RonnieRichards

Thank you @JonahLay that is very helpful to know and we will proceed with the new methods! 

Also thanks again @RandyCasey & @HannesZiegler for the quick responses are most appreciated! Please close this idea as functionality already exists in FeatureSharingDraft 

JonahLay
Status changed to: Already Offered

Users can use the FeatureSharingDraft to publish and overwrite tables.

Code samples are available in the documentation: