The extension allow you to create a URL aliases for datasets. For example, if you have a dataset with my-dataset name, it can be accessed via URL like that https://your-domain/dataset/my-dataset. Now you could add multiple aliases that will redirect user to the dataset.
Creating and managing aliases is easy. There are two ways to create an alias.
- An alias could be created automatically, if the
ckanext.alias.autosave_aliasconfig option in enabled. (see Config settings section below)The automatic creation will be triggered only if the new
namediffers from the previous one. - An alias could be created manually via dataset create/edit form.
Requirements
The extension has only been tested with CKAN 2.10.1 and will most likely not work with versions below 2.10.
Also, the extension relies on ckanext-scheming to add an alias field into schema. It won't work without scheming.
If you don't know what is it and how to use it, check its repo.
Installation
- Use
pipto install an extension:pip install ckanext-alias - Add
aliasto theckan.pluginssetting in your CKAN config file.
Add an alias field to schema
ckanext-alias requires adjusting a dataset schema, to add an alias field that will store all the information. The extension provides multiple presets, which you could use to easilly adjust the schema.
-
Add presets
scheming.presets = ckanext.alias:presets.yaml -
Open you schema. You have to edit
namefield and add a newaliasfield:- field_name: name preset: dataset_alias_slug - field_name: alias preset: dataset_alias- The
aliasfield name must be the same asckanext.alias.alias_fieldname. - Check
presets.yamlfile to see the presets in details. - If your
namefield was altered before, you don't have to use thedataset_alias_slugpreset. Just add thename_doesnt_conflict_with_aliasvalidator to list of yours.
- The
Config settings
The extension provides several configuration options to customize it.
# Specify a list of dataset types that is going to support aliases. Each specified dataset type schema
# must contain an alias field, otherwise, the extension isn't going to work (optional, default: dataset).
ckanext.alias.dataset_types = dataset project
# Specify an alias field name in dataset schema. The extension won't work, if the schema
# doesn't contain a specified field (optional, default: alias).
ckanext.alias.alias_fieldname = pkg_alias
# Specify whether a new alias will be created automatically on dataset update.
# If the name differs from the previous one, the alias will be created (optional, default: false).
ckanext.alias.autosave_alias = true
Developer installation
To install ckanext-alias for development, activate your CKAN virtualenv and do:
git clone https://github.com/DataShades/ckanext-alias.git
cd ckanext-alias
python setup.py develop
pip install -r dev-requirements.txt
Tests
To run the tests, do:
pytest --ckan-ini=test.ini
License
Metadata
Release files for ckanext-alias 1.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ckanext_alias-1.0.11.tar.gz | 23.6 kB | Without provenance | Details for ckanext_alias-1.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ckanext_alias-1.0.11-py3-none-any.whl | Python 3 | none | any | Details for ckanext_alias-1.0.11-py3-none-any.whl |
Total release size: 48.6 kB
Release files / ckanext_alias-1.0.11.tar.gz
| Download URL | ckanext_alias-1.0.11.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
478dd7777b50dd8804a570f38827b792019a7e693ca4e456f197ef4d10928ff9
|
|
BLAKE2b-256 checksum How to use checksums |
b4993557d4a65f1c6a2c4b2da1d576e129d17f0abace97383fdaed0aa5c6c6fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Release files / ckanext_alias-1.0.11-py3-none-any.whl
| Download URL | ckanext_alias-1.0.11-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0add5270373baba73f84a93182501df9c89c24760ab3cac240b698bce429c34f
|
|
BLAKE2b-256 checksum How to use checksums |
fe62766496a744070ceaa810e558f5a22cdcd32db09a200317d8e7d9fe217a70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Security for ckanext-alias 1.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.