Python script to create multiple file geodatabases from enterprise geodatabase,

7309
3
03-23-2014 12:14 PM
JamalNUMAN
Legendary Contributor
Python script to create multiple file geodatabases from enterprise geodatabase,

I�??m looking for a python script that creates multiple file geodatabases from multiple enterprise geodatabases in one go.

For example, in the screenshot below, I have 5 SQL geodatabase stored in the mdf folder, and I wanted to create 5 file geodatabases (from these SQL files) and store them in the gdb folder

[ATTACH=CONFIG]32427[/ATTACH], [ATTACH=CONFIG]32428[/ATTACH]


Is there such script?

Thank you

Best

Jamal
----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
I have not performed this operation and unsure of an exact solution, but have a look at the arcpy.ImportXMLWorkspaceDocument_management method:

http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000014s000000

IIRC, you can specify the target Geodatabase as an ArcSDE instance, perhaps if you have connections already setup you can simply reference the .sde file to set the workspace???  Not sure on that but might be worth to check into.
0 Kudos
by Anonymous User
Not applicable
Original User: mody

Hi Jamal

You should first create a connection file to each database.
Then try this:
arcpy.env.workspace = r'C:\Users\XXX\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog'
ls  = arcpy.ListFiles("*.sde")

Then you will have a list of all your databases.
For each one you should create a FGDB.
Then use arcpy.ListFeatureclasses to get a list of layers to copy.
For each one you should do Featureclass to Featureclass for each one.
If you have more complex data (relashenship, geometric network, etc) you will have to work harder.

Have fun
Mody
0 Kudos
JamalNUMAN
Legendary Contributor
Hi Jamal

You should first create a connection file to each database.
Then try this:
arcpy.env.workspace = r'C:\Users\XXX\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog'
ls  = arcpy.ListFiles("*.sde")

Then you will have a list of all your databases.
For each one you should create a FGDB.
Then use arcpy.ListFeatureclasses to get a list of layers to copy.
For each one you should do Featureclass to Featureclass for each one.
If you have more complex data (relashenship, geometric network, etc) you will have to work harder.

Have fun
Mody


Thank you very much James and mody for the help.

I thought that there might be a very end-user script tool that can be used to create file geodatabases from enterprise.

Best

Jamal
----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos