ckanext-dataproxy
ckanext-dataproxy is a CKAN extension that enables previewing data from remote databases via SQLAlchemy. The extension is compatible with datastore by masking the dataproxy resource as a datastore resource so it could be requested via /api/3/action/datastore_search or previewed in-browser with recline-preview.
This allows CKAN to use foreign data wrappers as a source for the datastore.
Installation
NB! This module is developed for CKAN v2.2.x and v2.5.x, compatibility with other versions is not ensured.
- Clone the repository:
cd /usr/lib/ckan/default/src
git clone https://github.com/cphsolutionslab/ckanext-dataproxy.git
cd ckanext-dataproxy
- Activate your virtual environment:
. /usr/lib/ckan/bin/activate
- Install requirements (It is not required to install drivers for databases you don’t plan to proxy):
pip install -r requirements.txt
Additional packages may be required to compile the database-specific drivers. For Ubuntu:
sudo apt-get install build-essential libmysqlclient-dev freetds-dev
- Install the plugin:
python setup.py develop
- Set the dataproxy secret in your CKAN settings file (e.g.
/etc/ckan/default/production.ini):
ckan.dataproxy.secret = c9f56fdfd12ee615f3d858... # Use a random secret
Generate a random secret:
echo "import hashlib ; from uuid import uuid4 ; print hashlib.sha256(str(uuid4())).hexdigest()" | python -
Enable on CKAN 2.2.x
Enable the extension by appending dataproxy to ckan.plugins:
ckan.plugins = stats text_preview ... dataproxy
Enable on CKAN 2.5.x
Enable the extension by appending dataproxy and dataproxy_view to ckan.plugins:
ckan.plugins = stats text_preview ... dataproxy dataproxy_view
Then append dataproxy_view to ckan.views.default_views:
ckan.views.default_views = image_view ... dataproxy_view
Usage
See the wiki for detailed usage instructions:
- Usage with CKAN 2.2.x
- Usage with CKAN 2.5.x