I am trying to update a layer in AGOL by truncating it in a python notebook and then appending the updated data using python's append function. I was able to truncate the AGOL layer in my python notebook, but the append takes too long or it just gets stuck. Note: There are about 200k records that need appended. Is there a better workflow for this task. I need it to be automated hence the python script
Hi @ChaceCarpenter,
I would highly suggest checking out python cursors as to potentially help speed up some processes. Often times it is easier to only append the necessary data rather than bulk updates. In conjunction with the cursors you can also use SQL query statements to also help speed up the process as well.
Can I compare the geometry of the feature class in agol to the newer feature class and only update the features whos geometry has changed with this method? I feel like comparing the 2 tables will require more computing power than just truncating and appending. Is this not true?
I used backed sql scripts to upsert and delete operations. it is much faster .
Are you using the sql within a arcpy function?
You are using service in agol, you could use sql query along with arcpy cursors to update/delete /insert. Append also uses upsert functionality. If you are using backend database like sqlserver, Postgre , you could use sql queries to update using some primary key field. Geometry field stored in the backend database as binary, you can’t compare that with another feature class using sql .