Select to view content in your preferred language

Python Script

2760
4
05-26-2015 02:58 PM
Jose_LuisGarcinuno-Oporto
Occasional Contributor

Is there any way to setup a

Begin Transaction

and

Commit or rollback

in a python script beside the try and except:

0 Kudos
4 Replies
WesMiller
Deactivated User

Not sure what your trying to do. You may find this link helpful ArcGIS Help 10.1

0 Kudos
Jose_LuisGarcinuno-Oporto
Occasional Contributor

Hi Wes thank you for your prompt answer. I have to run some back-up process during night that are very critical, What I am trying to catch is , if the script start running and it is half way through, suddenly stop for some reason, I would like to come back or RollBack my transaction to the 0 stage that why I am looking for type sort Begin transaction and Commit/rollback transaction as it is in SQL server.

WesMiller
Deactivated User

This article ArcGIS Help 10.1 will help with error catching and traceback for where the script fails. If you are backing up shapefiles or geodatabases i would simply rerun the script.

OwenEarley
Frequent Contributor

I think you are going to be stuck using a try catch block as it sounds like the python script is controlling how the update happens in your process. As Wes Miller suggests you could use an edit session to provide rollback capabilities but it is the try/catch block that will end up triggering the stopOperation or abortOperation calls for the edit session.