-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best way to copy datasets to another instance? #52
Comments
You can strip the
Afterwards if you also wanted to import organizations, they should have references to all the datasets and the mappings will be preserved. |
Thanks I'll give that a shot it sounds like it would work. Any idea why the
|
Probably for the same reason datasets were failing - datasets reference their organizations and vice versa. If the first command works you should be able to import all the orgs with:
I think that will preserve dataset mappings. In any case, it would be good for |
For anyone else with this issue, I had to delete the following 3 properties on the dataset dump records in order for $ jq --compact-output 'del(.owner_org,.resources[].revision_id,.organization.revision_id)' Also, FYI @deniszgonjanin I'm still getting the Update: I got both organizations and groups to load using the following jq command: $ jq --compact-output '{title: .title, name: .name}' |
Got it even more concise - rather than deleting specific properties, you can use jq to only use specific properties. I've compiled the 3 commands to copy organizations, groups, and datasets and have the datasets be associated with the organizations and groups: To copy the organizations $ ckanapi dump organizations --all -q -r https://opendataphilly.org \
| jq --compact-output '{name, title, description}' \
| ckanapi load organizations -c $CKAN_INI To copy the groups/topics $ ckanapi dump groups --all -q -r https://opendataphilly.org \
| jq --compact-output '{name, title, description}' \
| ckanapi load groups -c $CKAN_INI To copy the datasets $ ckanapi dump datasets --all -q -r https://opendataphilly.org \
| jq --compact-output '{name, title, notes, license_id, license_title, maintainer, maintainer_email, owner_org: .organization.name, extras, groups: [.groups[] | {name}], resources: [.resources[] | {url, name, format, description}]}' \
| ckanapi load datasets -c $CKAN_INI |
Hello, I'm trying to copy all the dataset metadata from opendataphilly.org to a local CKAN instance I have running on a digitalocean droplet. I'm using the command from the README:
And I'm getting the error
create ValidationError {"owner_org":["Organization does not exist"]}
repeatedly. I've tried creating the organization, but I assume becauseowner_org
references the organizations ID instead of its slug/name, and the one I just created has a brand new unique ID, it's still not working.I've tried doing a dump & load of the organizations but I get a stack trace of a python error:
Any idea the best way to copy these datasets over?
Also note that it doesn't have to be perfect as this is just for testing a script before using it on the production version of opendataphilly.
The text was updated successfully, but these errors were encountered: