{ "info": { "author": "Open Knowledge International", "author_email": "info@okfn.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# tableschema-ckan-datastore-py\n\n[![Travis](https://img.shields.io/travis/frictionlessdata/tableschema-ckan-datastore-py/master.svg)](https://travis-ci.org/frictionlessdata/tableschema-ckan-datastore-py)\n[![Coveralls](http://img.shields.io/coveralls/frictionlessdata/tableschema-ckan-datastore-py/master.svg)](https://coveralls.io/r/frictionlessdata/tableschema-ckan-datastore-py?branch=master)\n[![PyPi](https://img.shields.io/pypi/v/tableschema-ckan-datastore.svg)](https://pypi.python.org/pypi/tableschema-ckan-datastore)\n[![Github](https://img.shields.io/badge/github-master-brightgreen)](https://github.com/frictionlessdata/tableschema-ckan-datastore-py)\n[![Gitter](https://img.shields.io/gitter/room/frictionlessdata/chat.svg)](https://gitter.im/frictionlessdata/chat)\n\nGenerate and load CKAN DataStore tables based on [Table Schema](http://specs.frictionlessdata.io/table-schema/) descriptors.\n\n## Features\n\n- implements `tableschema.Storage` interface\n\n## Contents\n\n\n\n - [Getting Started](#getting-started)\n - [Installation](#installation)\n - [Examples](#examples)\n - [Documentation](#documentation)\n - [Storage](#storage)\n - [Contributing](#contributing)\n - [Changelog](#changelog)\n\n\n\n## Getting Started\n\n### Installation\n\nThe package use semantic versioning. It means that major versions could include breaking changes. It's highly recommended to specify `package` version range in your `setup/requirements` file e.g. `package>=1.0,<2.0`.\n\n```bash\npip install tableschema-ckan-datastore\n```\n\n### Examples\n\nCode examples in this readme requires Python 3.3+ interpreter. You could see even more example in [examples](https://github.com/frictionlessdata/tableschema-ckan-datastore-py/tree/master/examples) directory.\n\nWhen writing data, tableschema-ckan-datastore uses the [CKAN API `datastore_upsert` endpoint](https://ckan.readthedocs.io/en/latest/maintaining/datastore.html#ckanext.datastore.logic.action.datastore_upsert) with the `upsert` method. This requires a unique key in the data defined by a [Table Schema primary key property](https://specs.frictionlessdata.io/table-schema/#primary-key). If your data has a primary key, you can use the `table.save` method:\n\n```python\nfrom tableschema import Table\n\n# Load and save CKAN DataStore record\nresource_id = 'bd79c992-40f0-454a-a0ff-887f84a792fb'\nbase_url = 'https://demo.ckan.org'\ndataset_id = 'test-dataset-010203'\napi_key = 'my-ckan-user-api-key'\n\ntable = Table('data.csv', schema='schema.json') # data.csv has primary keys\ntable.save(resource_id,\n storage='ckan_datastore',\n base_url=base_url,\n dataset_id=dataset_id,\n api_key=api_key)\n```\n\nIf you need to define the method used to save data to the DataStore, you can create the `tableschema.Storage` object directly and specify which method parameter to use:\n\n```python\nimport io\nimport json\nfrom tabulator import Stream\nfrom tableschema import Storage\n\n# Load and save CKAN DataStore record\nresource_id = 'bd79c992-40f0-454a-a0ff-887f84a792fb'\nbase_url = 'https://demo.ckan.org'\ndataset_id = 'test-dataset-010203'\napi_key = 'my-ckan-user-api-key'\n\nschema = json.load(io.open('schema.json', encoding='utf-8'))\ndata = Stream('data.csv', headers=1).open()\n\nstorage = Storage.connect('ckan_datastore',\n base_url=base_url,\n dataset_id=dataset_id,\n api_key=api_key)\nstorage.create(resource_id, schema, force=True))\nstorage.write(resource_id, data, method='insert') # specify the datastore_upsert method\n```\n\n## Documentation\n\nThe whole public API of this package is described here and follows semantic versioning rules. Everything outside of this readme are private API and could be changed without any notification on any new version.\n\n### Storage\n\nPackage implements [Tabular Storage](https://github.com/frictionlessdata/tableschema-py#storage) interface (see full documentation on the link):\n\n![Storage](https://i.imgur.com/RQgrxqp.png)\n\nThis driver provides an additional API:\n\n#### `Storage(base_url, dataset_id=None, api_key=None)`\n- `base_url (str)` - the base url (and scheme) for the CKAN instance (e.g. http://demo.ckan.org).\n- `dataset_id (str)` - id or name of the CKAN dataset we wish to use as the bucket source. If missing, all tables in the DataStore are used.\n- `api_key (str)` - either a CKAN user api key or, if in the format `env:CKAN_API_KEY_NAME`, an env var that defines an api key.\n\n## Contributing\n\nThe project follows the [Open Knowledge International coding standards](https://github.com/okfn/coding-standards).\n\nRecommended way to get started is to create and activate a project virtual environment.\n\nTo install package and development dependencies into active environment:\n\n```\n$ make install\n```\n\nTo run tests with linting and coverage:\n\n```bash\n$ make test\n```\n\nFor linting `pylama` configured in `pylama.ini` is used. On this stage it's already\ninstalled into your environment and could be used separately with more fine-grained control\nas described in documentation - https://pylama.readthedocs.io/en/latest/.\n\nFor example to sort results by error type:\n\n```bash\n$ pylama --sort \n```\n\nFor testing `tox` configured in `tox.ini` is used.\nIt's already installed into your environment and could be used separately with more fine-grained control as described in documentation - https://testrun.org/tox/latest/.\n\nFor example to check subset of tests against Python 2 environment with increased verbosity.\nAll positional arguments and options after `--` will be passed to `py.test`:\n\n```bash\ntox -e py27 -- -v tests/\n```\n\nUnder the hood `tox` uses `pytest` configured in `pytest.ini`, `coverage`\nand `mock` packages. This packages are available only in tox envionments.\n\n## Changelog\n\nHere described only breaking and the most important changes. The full changelog and documentation for all released versions could be found in nicely formatted [commit history](https://github.com/frictionlessdata/tableschema-ckan-datastore-py/commits/master).\n\n#### v1.0\n\n- Initial driver implementation\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/frictionlessdata/tableschema-ckan-datastore-py", "keywords": "frictionless data,ckan,datastore", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tableschema-ckan-datastore", "package_url": "https://pypi.org/project/tableschema-ckan-datastore/", "platform": "", "project_url": "https://pypi.org/project/tableschema-ckan-datastore/", "project_urls": { "Homepage": "https://github.com/frictionlessdata/tableschema-ckan-datastore-py" }, "release_url": "https://pypi.org/project/tableschema-ckan-datastore/1.0.0/", "requires_dist": [ "six (>=1.9)", "tableschema (>=1.0)", "pylama ; extra == 'develop'", "tox ; extra == 'develop'", "python-dotenv ; extra == 'develop'" ], "requires_python": "", "summary": "Generate CKAN DataStore tables, load and extract data, based on Table Schema descriptors.", "version": "1.0.0" }, "last_serial": 5934249, "releases": { "0.0.2a0": [ { "comment_text": "", "digests": { "md5": "c55476f542ae67e692cb75e7d4ed2edb", "sha256": "db8c5b7ebe703dc0cd80b8c1451274686c1a76d5d6294f42d2474709b4b7e8a0" }, "downloads": -1, "filename": "tableschema_ckan_datastore-0.0.2a0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c55476f542ae67e692cb75e7d4ed2edb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11637, "upload_time": "2017-10-30T11:28:49", "url": "https://files.pythonhosted.org/packages/e3/ab/69e6cbb6f9c5e948ed10b2cb806fe58a82bf6e9e20437a1855d27aac99bb/tableschema_ckan_datastore-0.0.2a0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c5a602bcb17b0dcec7dcaa06d78473c0", "sha256": "cfaf11d46a69fefbf32b96e96f630c598b59ce60597a64fa2930dd744ec469d3" }, "downloads": -1, "filename": "tableschema-ckan-datastore-0.0.2a0.tar.gz", "has_sig": false, "md5_digest": "c5a602bcb17b0dcec7dcaa06d78473c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9285, "upload_time": "2017-10-30T11:28:50", "url": "https://files.pythonhosted.org/packages/72/9a/c7884eaffecb9a10082b66396f5f4a0cabf28b3a8c12abbde794daeaf44f/tableschema-ckan-datastore-0.0.2a0.tar.gz" } ], "0.0.3b0": [ { "comment_text": "", "digests": { "md5": "d74ea0e9a90d8674cd45893915cad03e", "sha256": "2e68a6d490eeb822a437b2835258463281e367315b5fa19b6cbb4027fed452dc" }, "downloads": -1, "filename": "tableschema_ckan_datastore-0.0.3b0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d74ea0e9a90d8674cd45893915cad03e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12464, "upload_time": "2017-10-31T17:07:46", "url": "https://files.pythonhosted.org/packages/ad/a7/245a6e221c9d523d5536391006df4a4c459d78492543e0850e9805e13804/tableschema_ckan_datastore-0.0.3b0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "12f6cdd00a3e871d865518e6f1ea0662", "sha256": "e7238da22694f60bb287e0c52ed16841b728dc08266124c0003c7c873416a4dd" }, "downloads": -1, "filename": "tableschema-ckan-datastore-0.0.3b0.tar.gz", "has_sig": false, "md5_digest": "12f6cdd00a3e871d865518e6f1ea0662", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9811, "upload_time": "2017-10-31T17:07:47", "url": "https://files.pythonhosted.org/packages/ea/83/1abf28aefc47771d56d0417de8c69ba3e24fd5e84e738130bc8de93be7a4/tableschema-ckan-datastore-0.0.3b0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "3d2ec7e8079157af862eb6ac1c5aadd0", "sha256": "82cf315e7bb08ac4345d27fc7efdb3dcc34490b17fa9d311e9d3454aefa57d5a" }, "downloads": -1, "filename": "tableschema_ckan_datastore-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3d2ec7e8079157af862eb6ac1c5aadd0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9836, "upload_time": "2019-10-06T08:54:22", "url": "https://files.pythonhosted.org/packages/ba/45/5efe1f392271d144c16ca693d6ae49a79659ddf2ed029385ca8947a3e429/tableschema_ckan_datastore-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c5f89682d883f42aa2d39d1323f0d4f2", "sha256": "6abbdf2c91982331081ee82bc400367881f32cd62c15517f6423bc5010ac1954" }, "downloads": -1, "filename": "tableschema-ckan-datastore-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c5f89682d883f42aa2d39d1323f0d4f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12100, "upload_time": "2019-10-06T08:54:24", "url": "https://files.pythonhosted.org/packages/ef/bb/402bf536016abbf70f51e0119f977f29bfd60a32e5c9626ff1560cc3dc64/tableschema-ckan-datastore-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3d2ec7e8079157af862eb6ac1c5aadd0", "sha256": "82cf315e7bb08ac4345d27fc7efdb3dcc34490b17fa9d311e9d3454aefa57d5a" }, "downloads": -1, "filename": "tableschema_ckan_datastore-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3d2ec7e8079157af862eb6ac1c5aadd0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9836, "upload_time": "2019-10-06T08:54:22", "url": "https://files.pythonhosted.org/packages/ba/45/5efe1f392271d144c16ca693d6ae49a79659ddf2ed029385ca8947a3e429/tableschema_ckan_datastore-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c5f89682d883f42aa2d39d1323f0d4f2", "sha256": "6abbdf2c91982331081ee82bc400367881f32cd62c15517f6423bc5010ac1954" }, "downloads": -1, "filename": "tableschema-ckan-datastore-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c5f89682d883f42aa2d39d1323f0d4f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12100, "upload_time": "2019-10-06T08:54:24", "url": "https://files.pythonhosted.org/packages/ef/bb/402bf536016abbf70f51e0119f977f29bfd60a32e5c9626ff1560cc3dc64/tableschema-ckan-datastore-1.0.0.tar.gz" } ] }