I am making my first attempt at editing an ArcSDE feature class with python through a da.UpdateCursor. I'm essentially taking code I've written for a file geodatabase feature class and applying it to an SDE feature class. Doing so produces an error, and I'm not sure how to rectify the problem.
I'm using ArcGIS 10.1 for Desktop.
Pertinent code:
Struxfeature = r"DatabaseConnections\PipelinePathways.sde\PPGIS.Strux\PPGIS.StruxPts_v04_all"
P6feature = r"DatabaseConnections\PipelinePathways.sde\PPGIS.Strux\PPGIS.Land_Projects_Parcels_P6"
SDE = r"Database Connections\PipelinePathways.sde"
UserID = "E1B8"
Parent = "SDE.DEFAULT"
version = "change_RW_VC_4447_14_to_C"
#Create Version
print "Creating version"
arcpy.CreateVersion_management(SDE, Parent, version, "PUBLIC")
VersionName = UserID.upper() + "." + version
#Layers
arcpy.MakeFeatureLayer_management (Struxfeature, "Struxlyr")
arcpy.MakeFeatureLayer_management (P6feature, "P6lyr")
#Switch to version
print "Switching version"
arcpy.ChangeVersion_management("Struxlyr", "TRANSACTIONAL", VersionName)
arcpy.ChangeVersion_management("P6lyr", "TRANSACTIONAL", VersionName)
#Start editing
print "Initiating editing"
edit = arcpy.da.Editor(SDE)
edit.startEditing()
# Start an edit operation
edit.startOperation()
#Change P6 project numbers
print "Updating P6.\n"
P6Cursor = arcpy.da.UpdateCursor ("P6lyr", ["P6_NBR", "Name"])
for row in P6Cursor:
codecodecode
The error comes from the line 'for row in P6Cursor:'
Traceback (most recent call last):
File "C:\E1B8\ScriptTesting\ScriptsIUse\ChangeP6.py", line 81, in <module>
for row in P6Cursor:
RuntimeError: workspace already in transaction mode