How To Overwrite a Feature Service To AGOL Using ArcPy

5785
2
Jump to solution
05-19-2020 07:30 AM
PatrickMcKinney1
Occasional Contributor III

I am trying to write a Python script to simply overwrite a feature layer to ArcGIS Online.  I have read some other GeonNet posts, and took a look at the Python API, but still can't find a good example for what I'm trying to do. 

The script would just overwrite the feature service in ArcGIS Online using the same local data source each time the script is run.  The dataset is changing on our system weekly.  But the service is published in ArcGIS Online because it gets a lot of traffic, and they can better handle scaling than our local server environment.  

If ArcGIS Pro would let you run this process as a geoprocessing tool, then I could just copy the Python code snippet.  Any tips or sample code would be very helpful.  

Here is a walk-through of the manual process:

Launch ArcGIS Pro document that contains local data source > sign-in to ArcGIS Online > manually overwrite feature service > close ArcGIS Pro.

By the way, I am open to ArcMap/Python 2 solution to this. Though I do prefer a Python 3 approach.

1 Solution

Accepted Solutions
JonahLay
Esri Contributor

Hi Patrick,

Are you aware of the examples in this thread? Automate overwrite web layer, feature class 

Hope it helps,

Jonah

View solution in original post

2 Replies
JonahLay
Esri Contributor

Hi Patrick,

Are you aware of the examples in this thread? Automate overwrite web layer, feature class 

Hope it helps,

Jonah

PatrickMcKinney1
Occasional Contributor III

That is exactly what I was looking for.  I was at a lost as to how to update the service definition associated with the existing service.  I was definitely on the right track.