Select to view content in your preferred language

Python Script to update file geodatabase with sde database

3239
4
02-15-2013 06:30 AM
joshlay
New Contributor
I have a standalone file geodatabase that is on ArcServer and I want to update it weekly using our sde database.  How do go about it using python script?

Thanks
0 Kudos
4 Replies
LeoDonahue
Deactivated User
you could start with using model builder and then export your model to a python script.

in data management tools (toolbox):
under workspace is the tool for creating a FGDB.
under general is the tool for deleting featureclasses
under feature class is the tool for creating a new featureclass
0 Kudos
AnthonyGiles
Honored Contributor
You can create a replica from your sde database to your file geodabase:

http://resources.arcgis.com/en/help/main/10.1/index.html#/Creating_a_one_way_or_two_way_replica/003n...

Then set up a model using the synchronize changes tool under distributed databases. Turn this model into a Pyton script then use a windows scheduled task to run the script once a week

Regards

Anthony
0 Kudos
MichaelVolz
Esteemed Contributor
The suggestion by Leo will work, but you will need to deal with the locks that are placed on a file geodatabase by ArcGIS Server.

I would suggest instead using the DeleteFeatures_management tool followed by the Append_management tool to avoid the locks.

You would have to stop the affected service of the file geodatabase if you want to delete the feature class and create it brand new each week.  Then you would have to restart the service once the feature class creation has been completed.
0 Kudos
joshlay
New Contributor
All,

Thanks for the speedy replies.  I will try it out and let you all know if i have any problems.

Thanks.
0 Kudos