joe990

ArcSDE FeatureClass update with edit session problems

Discussion created by joe990 on Nov 5, 2013
Latest reply on Jun 11, 2018 by pfoppe@blm.gov_BLM_EGIS
Hello,

I am trying to run an update on an ArcSDE FeatureClass using ArcPy.
With the goal of my code starting an edit session, making a change to my FC and then saving the changes, so this change will show up in the (date_Changed) attribute like ArcSDE is supposed to. This is my code below: (Just an example of trying to use the insertcursor, normally I would try to deletefeatures then append, but I figured start small first)




import arcpy
from arcpy import env
arcpy.MakeFeatureLayer_management(r'Database Connections\GISAdmin@SBMPERDBS003.sde\GISAdmin.Leonora_Drilling\GISAdmin.LEO_DH_Collars','LeoDHCollars')
arcpy.MakeXYEventLayer_management(r'\\SBMPERTST001\Applications\GIS\DataShed Exploration_LEO Export\Arc_DHCollars.csv',"NAT_East","NAT_North","LeoDHCollarsNEW")
arcpy.MakeFeatureLayer_management("LeoDHCollarsNEW",'LeoDHCollarslyr')
arcpy.ChangeVersion_management('LeoDHCollars','Transactional','GISADMIN.DataUpdates','')
workspace=r'Database Connections\GISAdmin@SBMPERDBS003.sde'
edit= arcpy.da.Editor(r'Database Connections\GISAdmin@SBMPERDBS003.sde')
edit.startEditing(True,True)
edit.startOperation()
with arcpy.da.InsertCursor("LeoDHCollars", ('SHAPE@', 'Hole_Type')) as icur:
    icur.insertRow([(7642471.100, 686465.725), 'New School'])
edit.stopOperation()
edit.stopEditing(True)
arcpy.DisconnectUser(r'Database Connections\SDE@SBMPERDBS003.sde', "ALL")
arcpy.ReconcileVersions_management(workspace,"ALL_VERSIONS","SDE.GIS_Default","GISADMIN.DataUpdates","LOCK_ACQUIRED","NO_ABORT","BY_OBJECT","FAVOR_TARGET_VERSION","POST","KEEP_VERSION")








The problem I am getting is RunTime Error: Workspace already in transaction mode.

Any thoughts of why?

Outcomes