Geoprocessing service editing issue with arcpy.da.Editor

731
11
Jump to solution
07-22-2021 09:38 AM
SreejithSreenivasan
New Contributor II

Have an issue with Geoprocessing service while doing start editing for more than one user at same time.

Input for Geoprocessing service is CAD drawing file(dgn/dwg) from web application. and Geoprocessing code is inserting the features to appropriate feature classes in enterprise geodatabase.

Enterprise geodatabase is versioned and editing is doing in SDE.Default. ArcGIS server version is 10.8

Please find the code snippets

eGeoDBWorkSpace = r"dbconnection.sde" #Enterprice geodatbase
----
edit = arcpy.da.Editor(eGeoDBWorkSpace)
try:
edit.startEditing(True, True) -- *Error
edit.startOperation()
inserCursor = arcpy.da.InsertCursor(polyFC,['ID',...., 'SHAPE@'])
for inRow in poly_insert_rows:
inserCursor.insertRow(inRow)
del inserCursor
arcpy.AddMessage("MP to Temp FC finished")
inserCursor = arcpy.da.InsertCursor(plynFC,['ID',...., 'SHAPE@')
for inRow in plyn_boundary_insert_rows:
inserCursor.insertRow(inRow)
del inserCursor
-------
-----
edit.stopOperation()
edit.stopEditing(True)
except Exception as err:
#arcpy.AddError(err)
if 'edit' in locals():
if edit.isEditing:
edit.stopOperation()
edit.stopEditing(False)

*Error : Getting error on this line , If editing started by one user request, between any other request came to the server.The new request will fail.

Really appreciate the support to resolve this issue.

 

0 Kudos
11 Replies
SreejithSreenivasan
New Contributor II

Thank you Davin for valuable input. Can we use arcpy.da.InsertCursor  with Feature service in arcpy with ArcGIS server (means without ArcGIS Pro) .Or we need to use apply edits to feature layer using python "urllib" libraries by making http calls with json input

0 Kudos
DavinWalker2
Esri Contributor

Hi Sreejith,

I have been successful using arcpy.da.InsertCursor with a Feature Service.

 

0 Kudos