Export dataset metadata from CKAN to Excel
Project description
An API client (usable as a command-line script or as a Python library) for exporting dataset metadata from CKAN sites to Excel-compatible CSV files.
This is a thin wrapper around [losser](https://github.com/ckan/losser), hooking it up to the CKAN API.
TODO: Document the preprocessing of dataset extras.
Requirements
Python 2.7, or 2.6 with the argparse library.
Installation
To install run:
pip install ckanapi-exporter
To install for development, create and activate a Python virtual environment then do:
git clone https://github.com/ckan/ckanapi-exporter.git cd ckanapi-exporter python setup.py develop
Usage
From the command line:
ckanapi-exporter –url ‘http://demo.ckan.org’ –columns columns.json > output.csv
This will:
Fetch metadata for all datasets from demo.ckan.org
Transform and filter the datasets according to the columns specified in columns.json
Write the result as UTF8-encoded, CSV-formatted text to output.csv
TODO: Document the columns.json file format.
Using as a Python library:
import ckanapi_exporter.exporter as exporter csv_string = exporter.export(’http://demo.ckan.org’, ‘columns.json’)
Returns a UTF8-encoded string.
The second argument can be either the filename of the columns.json file as a string, or a list of dictionaries (equivalent to the contents of columns.json file after loading the JSON).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ckanapi-exporter-0.0.1.tar.gz
.
File metadata
- Download URL: ckanapi-exporter-0.0.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d36f5a6a7c033677e631de8d81d33b2e5a532ce01f019b36c84d9df9a6e8280 |
|
MD5 | a00530d7c990cde3280727045350ac3f |
|
BLAKE2b-256 | df9d033dd92f2f7ae3a1db45fe60cd308c6da97a0fc5aeb5ca7e87b00c229fed |