Currently, there is no straightforward way to do several common maintenance tasks required to run a CKAN installation on an ongoing basis.
Perhaps, ckanapi can have a scripts directory with several helper utilities to help a CKAN sysadmin maintain a production CKAN with common chores, like:
"verify" a CKAN database (e.g. ensure FK relationships are sound, there are no orphaned resources, etc.)
"fix" a CKAN database by removing orphaned packages/resources; fix FK relationships, etc.
revoke API tokens for given users
detailed site info (status_show along with other info like number of datasets, users, resources, etc.)
detailed info for org-admins (org packages and their respective editors, org activity list, etc.)
Already, ckanapi is referred to in the Maintainer's guide for common maintenance tasks like exporting user accounts to json lines, why not use it as well for the above listed tasks as well?
At the same time, the scripts will be a good reference for more complex examples of ckanapi in action.
ckanapi is intended as an api client so it doesn't feel right to include code that directly accesses models in the ckan db. I'll close this in favor of https://github.com/ckan/ckan/issues/5590
Currently, there is no straightforward way to do several common maintenance tasks required to run a CKAN installation on an ongoing basis.
Perhaps, ckanapi can have a
scripts
directory with several helper utilities to help a CKAN sysadmin maintain a production CKAN with common chores, like:Already,
ckanapi
is referred to in the Maintainer's guide for common maintenance tasks like exporting user accounts to json lines, why not use it as well for the above listed tasks as well?At the same time, the scripts will be a good reference for more complex examples of
ckanapi
in action.