Skip to content

Automatic datastore resource aliases #264

Description

@jqnatividad

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions