Select to view content in your preferred language

Trouble exporting from model builder to python script

3104
1
05-02-2011 11:35 AM
by Anonymous User
Not applicable
Original User: Kreeves11674

I built a model that would copy mutiple feature datasets from one ArcSDE to another. In the model, everything worked fine. It would copy all six (6) feature datasets over. But once I exported the model to a python script, and ran it, it would only copy over the first feature dataset that was listed.
Is there something that I missed in the export process?  I am new to model builder and python, so please bear with me.  There are supposed to be 6 datasets to be copied, but the attached screenshot only shows one of them in the python script.  Any help would be greatly appreciated.

Kevin
0 Kudos
1 Reply
MathewCoyle
Honored Contributor
You need to make a list of your datasets and loop through them. I don't think python will be able to recognize multiple inputs through one copy tool. Something like this.

sde1 = #your source connection
sde2 = #your output connection
arcpy.env.workspace = sde1
datasetList = [dataset1, dataset2,...]
for dataset in datasetList:
    arcpy.Copy_management(dataset, sde2+dataset)


If you want to get ALL the datasets from an SDE GDB then you can also just do
datasetList = arcpy.ListDatasets("", "Feature")
0 Kudos