Select to view content in your preferred language

Publishing a layer creates lock and my python script cannot replace the feature class

Jump to solution
11-04-2021 11:49 AM
New Contributor III

Hello, I get a fresh csv every morning that I geocode and publish as a feature layer to be consumed in a dashboard. Now when I use python script to automate the workflow every morning, I see a lock from my ArcGIS Server service account. This lock (probably) doesn't let the python to overwrite the feature and a result, the new feature class that gets created appears in UPPER CASE and as a stand alone layer (not inside feature dataset). From second time around, the script just fails because either it couldn't overwrite the feature class or because it thinks there is already a feature class with that name inside the enterprise geodatabase. 

So, basically how can I overwrite a feature class that is published and hence has a lock from service account using python?   


Tags (3)
0 Kudos
11 Replies
Esri Contributor

Hi @al_Dhakal, I have faced a similar problem relating to the loading of data with locks occurring from the AGS.

My method around this, taking into account the client-specific workflow, was to stop the required service on AGS using python which releases the lock, load the data, and then restart the service.

Hope that helps.

New Contributor III

Hi all, thank you for all the suggestions. The easier solution that worked for my (as of now) is to use the database view and publish the view layer instead. This way, there is a lock established on the view feature class only and I can use python scripts to overwrite the original feature class. More on the database view here -

0 Kudos