生成ckan数据存储表,根据表模式描述符加载和提取数据。
tableschema-ckan-datastore的Python项目详细描述
ckan数据存储ckan数据存储库py
==
=
特拉维斯
br/>/>表架构/>;``描述符。
功能
——————————————————————————————————————————————————————————————————————————————————————这意味着主要的版本可能会包含破坏性的更改。强烈建议在"设置/要求"文件中指定"包"
版本范围,例如
"包">;=1.0,<;2.0`。
代码::bash
pip install tableschema ckan datastore
examples
~~~~~~~~~
本自述文件中的代码示例需要python 3.3+解释器。您可以在
examples<;https://github.com/frictionlessdata/tableschema ckan datastore py/tree/master/examples>;` `docs.io/en/latest/maintaining/datastore.html\ckanext.datastore.logic.action.datastore\u upsert>;`\uu
使用"upsert"方法。这需要由"表架构主键"属性lt;https://specs.frictionlessdata.io/table schema/"主键"属性定义的数据中的唯一键
。如果数据有主键,则可以使用"table.save"方法:
。代码::python
from tableschema import table
/>
table=table('data.csv',schema='schema.json')\data.csv有主键
table.save(resource戥id,
storage='ckan戥u datastore',
base戥url=base戥url,
dataset戥id=dataset戥id,
api戥key=api戥key)
d要定义用于将数据保存到数据存储的方法,可以直接创建"tableschema.storage"对象,并指定要使用的
方法参数:
。代码::python
import io
import json
from tabletor import stream
from tableschema import storage
taset_id='测试数据集-010203'
api_key='我的ckan用户api key'
data=stream('data.csv',headers=1)。open()
storage=storage.connect('ckan_datastore',
base_url=基本URL,
数据集ID=数据集ID,
API密钥=API密钥
存储。创建(资源ID,架构,强制=真))
存储。写入(资源ID,数据,方法='insert');指定数据存储的upsert方法
文档
——
这里描述了这个包的整个公共api,并遵循
语义版本控制规则。此自述文件之外的所有内容都是私有的
API,可以在不通知任何新版本的情况下进行更改。
~~~~~~~
package实现"tabular
storage<;https://github.com/frictionlessdata/tableschema py\storage>;``uu
接口(请参阅完整文档链接上的地址:
>这个驱动程序提供了一个附加的api:
``存储(基库URL,数据集ID=none,API密钥=none)` ` ` `
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^对于ckan实例
(e.g.http://demo.ckan.org)。
-``数据集id(str)``-我们希望使用
作为bucket源的ckan数据集的id或名称。如果缺少,则使用数据存储中的所有表。
-``api_key(str)``-ckan user api key,或者,如果格式为
``env:ckan_api_key_name```,则使用定义api key的env var。
kfn/编码标准>;``创建并激活项目
代码:bash
$make test
在这个
阶段,它已经
安装到您的环境中,可以与文档中描述的更多
细粒度控制单独使用-
https://pylama.readthedocs.io/en/latest/
例如,按错误类型对结果排序:
。代码::bash
$pylama--sort<;path>;
针对python 2环境的测试,
详细程度增加。
`--``之后的所有位置参数和选项都将传递给
``py.test`:
代码::bash
tox-e py27--v tests/<;path>;
此软件包仅在tox
环境中可用。此处仅描述了中断和最重要的更改。所有已发布版本的完整
更改日志和文档可以在
格式良好的"提交
历史记录"中找到,https://github.com/frictionlessdata/tableschema ckan datastore py/commits/master>;` `| travis image::https://img.shields.io/travis/friectionlessdata/tableschema ckan datastore py/master.svg
:目标:https://travis ci.org/friectionlessdata/tableschema ckan datastore py
。|工作服图片::http://img.shields.io/covertalls/frictionlessdata/tableschema ckan datastore py/master.svg
:目标:https://covertalls.io/r/frictionlessdata/tableschema-ckan-datastore-py?分支=主
…| pypi image::https://img.shields.io/pypi/v/tableschema ckan datastore.svg
:目标:https://pypi.python.org/pypi/tableschema ckan datastore
。| gitter图像::https://img.shields.io/gitter/room/friectionlessdata/chat.svg
:目标:https://gitter.im/friectionlessdata/chat
。|存储图像::https://i.imgur.com/rqgrxqp.png
==
=
特拉维斯
br/>/>表架构/>;``描述符。
功能
——————————————————————————————————————————————————————————————————————————————————————这意味着主要的版本可能会包含破坏性的更改。强烈建议在"设置/要求"文件中指定"包"
版本范围,例如
"包">;=1.0,<;2.0`。
代码::bash
pip install tableschema ckan datastore
examples
~~~~~~~~~
本自述文件中的代码示例需要python 3.3+解释器。您可以在
examples<;https://github.com/frictionlessdata/tableschema ckan datastore py/tree/master/examples>;` `docs.io/en/latest/maintaining/datastore.html\ckanext.datastore.logic.action.datastore\u upsert>;`\uu
使用"upsert"方法。这需要由"表架构主键"属性lt;https://specs.frictionlessdata.io/table schema/"主键"属性定义的数据中的唯一键
。如果数据有主键,则可以使用"table.save"方法:
。代码::python
from tableschema import table
/>
table=table('data.csv',schema='schema.json')\data.csv有主键
table.save(resource戥id,
storage='ckan戥u datastore',
base戥url=base戥url,
dataset戥id=dataset戥id,
api戥key=api戥key)
d要定义用于将数据保存到数据存储的方法,可以直接创建"tableschema.storage"对象,并指定要使用的
方法参数:
。代码::python
import io
import json
from tabletor import stream
from tableschema import storage
taset_id='测试数据集-010203'
api_key='我的ckan用户api key'
storage=storage.connect('ckan_datastore',
base_url=基本URL,
数据集ID=数据集ID,
API密钥=API密钥
存储。创建(资源ID,架构,强制=真))
存储。写入(资源ID,数据,方法='insert');指定数据存储的upsert方法
文档
——
这里描述了这个包的整个公共api,并遵循
语义版本控制规则。此自述文件之外的所有内容都是私有的
API,可以在不通知任何新版本的情况下进行更改。
package实现"tabular
storage<;https://github.com/frictionlessdata/tableschema py\storage>;``uu
接口(请参阅完整文档链接上的地址:
>这个驱动程序提供了一个附加的api:
``存储(基库URL,数据集ID=none,API密钥=none)` ` ` `
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^对于ckan实例
(e.g.http://demo.ckan.org)。
-``数据集id(str)``-我们希望使用
作为bucket源的ckan数据集的id或名称。如果缺少,则使用数据存储中的所有表。
-``api_key(str)``-ckan user api key,或者,如果格式为
``env:ckan_api_key_name```,则使用定义api key的env var。
kfn/编码标准>;``创建并激活项目
代码:bash
$make test
在这个
阶段,它已经
安装到您的环境中,可以与文档中描述的更多
细粒度控制单独使用-
https://pylama.readthedocs.io/en/latest/
例如,按错误类型对结果排序:
。代码::bash
$pylama--sort<;path>;
针对python 2环境的测试,
详细程度增加。
`--``之后的所有位置参数和选项都将传递给
``py.test`:
代码::bash
tox-e py27--v tests/<;path>;
此软件包仅在tox
环境中可用。此处仅描述了中断和最重要的更改。所有已发布版本的完整
更改日志和文档可以在
格式良好的"提交
历史记录"中找到,https://github.com/frictionlessdata/tableschema ckan datastore py/commits/master>;` `| travis image::https://img.shields.io/travis/friectionlessdata/tableschema ckan datastore py/master.svg
:目标:https://travis ci.org/friectionlessdata/tableschema ckan datastore py
。|工作服图片::http://img.shields.io/covertalls/frictionlessdata/tableschema ckan datastore py/master.svg
:目标:https://covertalls.io/r/frictionlessdata/tableschema-ckan-datastore-py?分支=主
…| pypi image::https://img.shields.io/pypi/v/tableschema ckan datastore.svg
:目标:https://pypi.python.org/pypi/tableschema ckan datastore
。| gitter图像::https://img.shields.io/gitter/room/friectionlessdata/chat.svg
:目标:https://gitter.im/friectionlessdata/chat
。|存储图像::https://i.imgur.com/rqgrxqp.png