Installation:
pip install ckanext-ingest
With XLSX support:
pip install ‘ckanext-ingest[xlsx]’
Add to ckan.plugins:
ingest
Configuration:
List of allowed ingestion strategies (empty = all allowed)
ckanext.ingest.strategy.allowed = ingest:recursive_zip
List of disabled ingestion strategies
ckanext.ingest.strategy.disabled = ingest:scheming_csv
Base template for WebUI (default: page.html)
ckanext.ingest.base_template = admin/index.html
Allow moving existing resources between packages (default: false)
ckanext.ingest.allow_resource_transfer = true
Rename strategies using JSON object mapping
ckanext.ingest.strategy.name_mapping = {“ckanext.ingest.strategy.zip:ZipStrategy”: “zip”}
Usage via CLI:
ckanapi action ingest_import_records source@path/to/data.zip strategy=”myext:extract_archive”
Implement IIngest interface to register custom strategies:
class MyPlugin(p.SingletonPlugin):
p.implements(IIngest)
def get_ingest_strategies(self):
return {
"my:custom_strategy": CustomStrategy,
}
Built-in strategies:
- ingest:scheming_csv: CSV with ckanext-scheming field mapping
- ingest:recursive_zip: Process ZIP archives recursively
- ingest:xlsx: Process Excel spreadsheets (requires openpyxl)
API actions:
- ingest_extract_records: Extract records from source (debugging)
- ingest_import_records: Ingest records and create/update data
Strategy delegation, record options (update_existing, nested_strategy, locator, extras), and ckanext-scheming integration with field mapping via ingest_options are supported.
Testing: pytest –ckan-ini=test.ini