Select to view content in your preferred language

Help appending all of the feature classes in one enterprise database to a template enterprise geodatabase using model builder

2661
16
11-16-2021 12:44 PM
MatthewBeal
Occasional Contributor III

I am working on moving our GIS data from an old server to a new one. I've created the enterprise geodatabase on the new server, and have imported the schema from the old enterprise geodatabase from the old server. The new server now contains a bunch of empty template feature classes. I now need to figure out the best way to load or append all of the data from the old server into the new one. I have ~500 feature classes to do this for, so I'd prefer not to do it manually. I do not know python well enough to utilize it for this task, so I think my best option is to try and work something out with model builder. Any suggestions?

I'm running into a wall because I can't figure out how to tell model builder to append the data from the old server to the feature class that has the same name on the new server. I feel like I'm missing something with the iterators but I can't quite piece it together.

0 Kudos
16 Replies
curtvprice
MVP Esteemed Contributor

You need to do an iterator and then use the %Name% field to find the input for the append tool.

I think a good approach to getting started is to use an iterator with the Calculate Value tool to generate the paths you need, when you get that working, you can feed those paths to the append tool.

0 Kudos
MatthewBeal
Occasional Contributor III

Could you expand on the calculate value tool? Here is what I have so far: 

 

MatthewBeal_0-1637097551244.png

 

 

 

0 Kudos
curtvprice
MVP Esteemed Contributor

I would delete the append tool for now and use the Calculate Value tool with an expression like this to generate the output path:

output\enterprise\geodatabasepath\%Name%

Then run the iterator model and see if the output paths are correct. If they look good, add the Append back and connect that Calculate Value output  (set its data type to feature class in the CV tool first)  to the Append tool as an input.

0 Kudos
MatthewBeal
Occasional Contributor III

I'm sure I did something wrong, but I added the calculate value with the following parameters:

MatthewBeal_3-1637098737205.png

 

 

When I ran just that portion of the tool, I got the following Error message:

MatthewBeal_4-1637098758464.png

 

ERROR 000539: File "<expression>", line 1
C:\Users\mbeal\AppData\Roaming\Esri\ArcGISPro\Favorites\FeatureClass
^
SyntaxError: invalid syntax
Failed to execute (Calculate Value).

 

Full model so far: 

 

MatthewBeal_5-1637098812621.png

 

0 Kudos
curtvprice
MVP Esteemed Contributor

Here's my attempt at a workflow for you, which I set up using file geodatabases; should work the same with Enterprise if the paths are correct. The tricky part is that Calculate Value expression is   (a) a Python string expression and (b) the "r" is a raw string to protect the backslashes.

Run this thing and if the paths look right, add the Append tool to the model, connecting the two feature class variables (old and new) to the append tool.

The preconditions both document what you are doing and also make sure that the model variables used within the Calculate Value expression are up to date during each iteration.

Hope this helps you out!

path_model.jpg

 

0 Kudos
MatthewBeal
Occasional Contributor III

This is extremely helpful. I was able to get it to recreate the correct file path using this setup. When I add the append tool, however, I get a new series of errors: 

MatthewBeal_0-1637160610255.png

ERROR 000622: Failed to execute (Append). Parameters are not valid.
ERROR 002948: The shape type of C:\Users\mbeal\AppData\Roaming\Esri\ArcGISPro\Favorites\OCGIS21_Vector - GISadmin.sde\OCGIS_2020.DBO.OconeeSoils_March20201 is not the same as that of previously entered datasets.
ERROR 000229: Cannot open C:\Users\mbeal\AppData\Roaming\Esri\ArcGISPro\Favorites\OCGIS21_Vector - GISadmin.sde\OCGIS_2020.DBO.OconeeSoils_March20201
Failed to execute (Append).

The parameters that I have used for the Append tool are as follows:

MatthewBeal_1-1637160663126.png

Could it be the feature datasets in the EGDB throwing it off? 

0 Kudos
curtvprice
MVP Esteemed Contributor

I would try to run the append command manually first. If the inputs paths are correct this is not a ModelBuilder problem.

Feature datasets could possibly mess with the path issue (requiring more complex logic for your Calculate Value expression) but you said the paths were correct.

Wondering about your "Favorites" paths - have the EGDBs been added to the project? I don't know if that matters or not.

0 Kudos
MatthewBeal
Occasional Contributor III

Actually I was wrong. Upon looking closely, it is the feature dataset. It is not being included in the the file path. It is just using the database name and then the feature class. Completely skipping the feature dataset. Any ideas on how I could force it to include that as well?

0 Kudos
curtvprice
MVP Esteemed Contributor

Try the Parse Path tool to manipulate the Feature Class pathname. Then include that variable (containing the feature class name) in your output path. You'll need to use it twice, first to pull out the full path to the feature dataset, a second run to strip out the feature dataset name.

0 Kudos