Copying entity locations from one database to another #3089
soininen
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is a short example on a Toolbox workflow that copies entity locations from one database to another.
Our workflow looks like this:
The Source Data store contains the source database from which we want to copy the location data to matching entities in the database referenced by Target. The copying is done by a Python script in Copy locations Tool.
The script looks like this:
sys.argvto access the arguments in a simple use case like this is OK but personally, I would switch toargparsefor anything more complex.DatabaseMapping, we fetch entity location data and reorganize it by entity class and entity so we can find the correct location for each target entity more easily.location_by_entitydict, we update the entity. Note, that we modifyentityitems directly here, notentity_locationitems --- it is just more convenient to do so.To make Toolbox feed the Copy location Tool the URLs as command line arguments, we need to drag and drop the database resources provided by the Source and Target databases into the Tool arguments list in the properties dock of the Copy locations Tool:
That's it! The entity locations will be copied from Source to Target when executing the project.
Beta Was this translation helpful? Give feedback.
All reactions