Geodatabase Archiving Script

841
9
08-05-2013 10:36 PM
JoeHewitt
New Contributor III
Hi,

I am writing a python script,  which is a weekly update of a shapefile. (if I was not going to use my geodatabase it is essentially create new shapefile from excel sheet, copy old shapefile renaming it and copying it to my archive folder, and then copying the new shapefile and placing it in my current folder) but I definently do want to use my geodatabase archiving methods.

However with geodatabase I have seen there is archiving options that reduce the need to rename/ move folder. but as there is no toolbox methods to do this is it even viable via python?


Essentially I am wanting to write a python script to automate Geodatabase Archiving (Enable Archiving, Creating Historical Markers) is this possible?
Tags (2)
0 Kudos
9 Replies
markdenil
Occasional Contributor III
Yes indeed, what you describe is quite possible using python,
It is pretty straightforward.

The similarity to Geodatabase Archiving is only superficial.
Geodatabase Archiving is performed on an enterprise relational database utilizing versioning.
What you are doing is very much simpler.

The date functions in python (for example, strftime) give
a great range of options for formatting the time stamp string
you would (likely) want to add to base shape file name.
Otherwise, it is basicaly finding and copying shapefiles....

In any event, one would want to build it as a custom tool rather than have a pre-built tool
with the pethora of options a general tool would need to cover all cases.
0 Kudos
JoeHewitt
New Contributor III
Yes indeed, what you describe is quite possible using python,
It is pretty straightforward.

The similarity to Geodatabase Archiving is only superficial.
Geodatabase Archiving is performed on an enterprise relational database utilizing versioning.
What you are doing is very much simpler.

The date functions in python (for example, strftime) give
a great range of options for formatting the time stamp string
you would (likely) want to add to base shape file name.
Otherwise, it is basicaly finding and copying shapefiles....

In any event, one would want to build it as a custom tool rather than have a pre-built tool
with the pethora of options a general tool would need to cover all cases.


Sorry I worded my question very poorly.
I already have the script to archive without the use of gdb.

But now I want to utilize Geodatabase archiving.

So the steps in my script would be 1. Enabling Archiving. 2. Create Historical Marker (Start an edit session, add my new features, save edit reconcile and post, click historical marker manager to create the new marker)

Im not sure if this is possible as there seems to be now way to do it as a geoprocess. But if anyone has maybe tried it/alternative method?
0 Kudos
ChrisSnyder
Regular Contributor III
Are you running ArcSDE? As far as I know, FGDB and PGDB formats don't suport archiving/versioning.

In the interest of keeping things simple and straightforward (which is always a good idea), I don't see much wrong with what you are doing. That same copy/rename/repost stategy can be applied to FGDB, GRID, SHP, PGDB, SDE, whatever. I do it all the time - it's great.

It may be more "efficient" database/storage-wise to implement SDE enterprise archiving/versioning, but I know it isn't easier.
0 Kudos
JoeHewitt
New Contributor III
Are you running ArcSDE? As far as I know, FGDB and PGDB formats don't suport archiving/versioning.

In the interest of keeping things simple and straightforward (which is always a good idea), I don't see much wrong with what you are doing. That same copy/rename/repost stategy can be applied to FGDB, GRID, SHP, PGDB, SDE, whatever. I do it all the time - it's great.

It may be more "efficient" database/storage-wise to implement SDE enterprise archiving/versioning, but I know it isn't easier.


Yes this is with ArcSDE.

Whats wrong with what im doing with the copy/rename/repost is that it is leading to hundreds of archived shapefiles. But as I am aware with SDE you can just have the one shapefile and the archives will be documented within that one shapefile....

So if there is anyway I would much rather do that.
0 Kudos
ChrisSnyder
Regular Contributor III
Hmmm. Nothing I see here: http://resources.arcgis.com/en/help/main/10.1/index.html#//003n000000sr000000 leads me to believe you can script this. Can you handle it all through plain versions? That you can script.
0 Kudos
ChrisSnyder
Regular Contributor III
Also, by "shapefile" I think you mean ArcSDE featureclass, right?
0 Kudos
MattSayler
Occasional Contributor II
I don't think you strictly need to script Archiving. As I understand it, it keeps track of changes to the Default version. I don't remember the specific details (the documentation has it though), but it adds a couple date fields that are sort of like "this feature looked like this from X to Y".

The Historical Markers are for marking specific events in time ("Subdivision Blah Built"). Depending on needs it might be nice to script those I suppose, but if I understand correctly, once Archiving is setup for a feature it will capture the changes regardless.
0 Kudos
JoeHewitt
New Contributor III
Also, by "shapefile" I think you mean ArcSDE featureclass, right?

right.



I don't think you strictly need to script Archiving. As I understand it, it keeps track of changes to the Default version. I don't remember the specific details (the documentation has it though), but it adds a couple date fields that are sort of like "this feature looked like this from X to Y".

The Historical Markers are for marking specific events in time ("Subdivision Blah Built"). Depending on needs it might be nice to script those I suppose, but if I understand correctly, once Archiving is setup for a feature it will capture the changes regardless.


Okay I see, im thinking I could potentially archive  by using python to open an edit session, and then using an update cursor, add my feature or update the current featues table with my changes from the new feature.
hopefully this works.
0 Kudos
JillianPenney
Esri Contributor
0 Kudos