Skip to content
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

Automatic datastore resource aliases #264

Open
jqnatividad opened this issue Nov 24, 2020 · 0 comments
Open

Automatic datastore resource aliases #264

jqnatividad opened this issue Nov 24, 2020 · 0 comments

Comments

@jqnatividad
Copy link
Contributor

jqnatividad commented Nov 24, 2020

A CKAN configuration option to set resource alias automatically:

ckan.datastore.auto_alias = True/False
ckan.datastore.auto_alias_template = {package-id}-{resource-title}

where ckan.datastore.auto_alias_template is a python format() string, with predefined placeholder values {package-id}, {resource-title}, {organization-id}, etc, and a default setting of "{package-id}-{resource-title}" or "{organization-id}-{package-id}-{resource-title}"

when datastore_create is called and auto_alias is True, it will automatically create the alias using the template. The existing behavior of existing aliases being overwritten is actually desirable, as this allows Datastore API users to use the latest resource using the alias without depending on the resource-id hash and make their code more readable.

This ability is quite useful with scheming as well, especially if you're using the datastore_choices_helper, as your scheming configuration will not have to hardcode a resource-id, and will automatically use the latest version of the resource using the alias.

cc @ckan/core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant