Need help with modelbuilder -> python tool for SDE version backup

2716
2
07-30-2013 05:59 AM
BrettRosso
New Contributor III
Hello,

We are trying to create a tool that iterates through a list of commonly edited feature classes in our SDE and based on the field LAST_EDITOR and LAST_UPDATE, it should export the records that have been edited within a version in the last 7 days. We have got the process down to do single feature exports but we would like to have an end product in python that we can have windows scheduler run weekly prior to our reconcile and post process. The problem I am having is in model builder, I am not sure if my 'Iterate Multivalue' iterator is actually running through each time. We are also going to have a problem with the output name of the file geodatabase we're running the feature class backups to after one time running through will have the same name and thus will most likely error out. We thought of adding a timestamp to the export name everytime it's ran. After a session with an ESRI analyst on the phone we figured out that the modelbuilder tool must be ran through ArcGIS as when the expression is applied it can only be exported to a feature layer first, then to a feature class. The python script is attached to this post. Any help here would be GREATLY appreciated.

Thank you,

Brett Rosso
GIS Mapping Technician
City of Longmont, Colorado


[ATTACH=CONFIG]26307[/ATTACH]
0 Kudos
2 Replies
StacyRendall1
Occasional Contributor III
I will try to pick your question apart, but I cannot tell what exactly you are asking as it seems like you have three or four different problems/questions.

The problem I am having is in model builder, I am not sure if my 'Iterate Multivalue' iterator is actually running through each time.

Why do you think this? Have you tried setting up your inputs, then right clicking it and selecting 'Run'? This will run just the iterator, and should display the outputs in a dialogue...

We are also going to have a problem with the output name of the file geodatabase we're running the feature class backups to after one time running through will have the same name and thus will most likely error out. We thought of adding a timestamp to the export name everytime it's ran.

Great. What is the problem? This is pretty easy to do in Python with an Arcpy script, but it might be very hard to do within model builder.

After a session with an ESRI analyst on the phone we figured out that the modelbuilder tool must be ran through ArcGIS as when the expression is applied it can only be exported to a feature layer first, then to a feature class.

I do not understand what you are saying here. Many tools only run on feature layers.

The python script is attached to this post. Any help here would be GREATLY appreciated.


Are you trying to use it as a Python script, or did you just use that as a way of sending your model?

If you are using it as a Python script do you want someone to try and edit it to do what you want?
0 Kudos
by Anonymous User
Not applicable
Original User: rzufelt

We are also going to have a problem with the output name of the file geodatabase we're running the feature class backups to after one time running through will have the same name and thus will most likely error out. We thought of adding a timestamp to the export name everytime it's ran.


You can put this in your python code:

# Overwrite pre-existing files
arcpy.env.overwriteOutput = True

and will overwite files that exist (well, normally, there are some that this doesn't work for so need to delete/rename first)

also, if running as model, in arcmap, geoprocessing options,  first checkbox, "Overwrite the outputs of geoprocessing operations" will do the same thing.  I.e., works most the time, but not for all datasets/operations.

R_
0 Kudos