SQL Server 2014
I’m trying to update a versioned feature class within an enterprise geodatabase with the following script:
import arcpy from arcpy import env env.workspace = r"D:\Data\GIS.sde" fc = "Util_SW_outfall" # Start an edit session edit = arcpy.da.Editor(env.workspace) # Change second parameter to True for versioned data edit.startEditing(False, True) edit.startOperation() # Update field with arcpy.da.UpdateCursor(fc, ['County']) as cursor: for row in cursor: row = 'test' cursor.updateRow(row) # Stop Edit Session edit.stopOperation() edit.stopEditing(True) del cursor
However, I receive the following error:
Traceback (most recent call last):
File "<string>", line 254, in run_nodebug
File "<module1>", line 21, in <module>
RuntimeError: start edit session
I was able to get the above to work with a File Geodatabase feature class. I feel like my turkey coma is allowing me to miss something simple, but can’t figure it out. Anyone have any suggestions?
I have a very similar problem, but the script works when running alone, it has the exactly behavior as yours when running inside a python tool box. Reading your explanation about get it done with gdb at least give me some hope, thanks. But I am very frustrated with the impossibility of using a sde connection correctly, probably I have to change my map service to a gdb now, instead of my microsoft sql table. Somebody knows if it is a reported bug (I'm using 10.3.1) or we are just missing something?