Automatic datastore resource aliases
- Dominant language
- No language data
- Stars
- 39
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
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](https://www.w3schools.com/python/ref_string_format.asp), 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](https://github.com/ckan/ckanext-scheming#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
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names datastore_create as the entry point; inspect its current alias behavior and configuration handling first. Define how the Python format template resolves the listed placeholders and how auto_alias interacts with existing aliases. Done means the configuration is honored and the latest resource is addressable through the generated alias, with coverage for the documented options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100