AnsweredAssumed Answered

Edit start/stop operation question

Question asked by MollyKFoley on May 22, 2020
Latest reply on May 28, 2020 by bixb0012

I'm trying to understand the editor in arcpy and I notice there is a startEditing method and a startOperation method. I'm wondering what the cadence is to using the startOperation method, I don't really get what it's purpose is. Right now, this is essentially how I do my edits:

 

collector_db_con = r"Database Connections\CollectorSpatialData_CollectorWriter.sde"
editor = arcpy.da.Editor(collector_db_con)
editor.startEditing(False, False)
editor.startOperation()

#Create cursor one
#Do insert/update
#Delete cursor one

#Create cursor two
#Do insert/update
#Delete cursor two

#Create cursor three
#do insert/update
#Delete cursor three

editor.stopOperation()
editor.stopEditing(True)
del editor

 

Are you supposed to be using start/stop operation more like this, or like if you were switching between editing different feature classes in the same geodatabase? 

collector_db_con = r"Database Connections\CollectorSpatialData_CollectorWriter.sde"
editor = arcpy.da.Editor(collector_db_con)
editor.startEditing(False, False)
editor.startOperation()

#Create cursor one
#Do insert/update
#Delete cursor one
editor.stopOperation()

editor.startOperation()
#Create cursor two
#Do insert/update
#Delete cursor two
editor.stopOperation()

editor.startOperation()
#Create cursor three
#do insert/update
#Delete cursor three

editor.stopOperation()
editor.stopEditing(True)
del editor

Outcomes