4

I am editing a versioned SDE Feature class with arcpy (ArcGIS 10.2.1).

I know that to edit versioned data you should use the arcpy.da.Editor, start editing, start operation, do your edits, stop operation, and stop editing (use stopEditing(True) to stop editing and save edits).

My question, is there a way with arcpy to save your edits without stopping your edit session like you can in ArcMap?

If you right click on "Editor" then "Save Edits" on the Editor toolbar in ArcMap it will save your edits and not stop your edit session.

Is this possible using arcpy?

  • Do You want to edit shapes or attributes? – BBG_GIS Nov 23 '16 at 3:52
  • I want to edit the attributes – bighill Nov 23 '16 at 16:02
  • So why dont you use update cursor instead of edit ? – BBG_GIS Nov 23 '16 at 16:03
  • 1
    I am using an update cursor but since I am editing a versioned sde feature class I have to instantiate an arcpy.da.Editor object, start an edit session, start an operation, run the update cursor, stop the operation, and stop the edit session. arcpy daeditor trials and tribultations. The actual save occurs on the stopEditing command. I want to save and not stop editing. – bighill Nov 23 '16 at 16:15
  • I don't think there is a way to save without stop editing. You can encapsulate operations for undo-redo but that's about it. Your editor is instantiated already so it is not difficult to start editing again. – Ben S Nadler Dec 20 '16 at 17:09
1

It looks like the only way ArcPy allows for Saving Edits is through the Stop Editing method. No other method allows a parameter to save an edit. @BenSNadler is correct in his comment above.

Here is Esri's documentation for these methods: Editor - arcpy reference

Depending on your needs, you could use one of Esri's tools that updates attribute information but does not require an edit session, e.g. field calculator.

  • I agree, it seems these are the only two options when working with ArcPy that I could find. – bighill Jan 11 '17 at 16:55
0

This is not just a limitation of using ArcPy. The same thing happens at a deeper level within Arcmap. Within ArcMap when you use the "SaveEdits" command it does a OnStopEditing event (operation) with a save followed by a OnStartEditing event (Operation). There is no SaveEdit command/operation just a OnStopEditing with or without a save operation. ESRI IEditEvents Interface There is no way round this. Using arcobjects code (I use ArcObjects in .NET) there is also no way the tell if the command executed was SaveEdits or StopEditor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.