基于json表模式描述符生成bigquery表,加载和提取数据。
tableschema-bigquer的Python项目详细描述
table schema bigquery py
===
工作服
pypi
gitter
基于"table
schema<;http://specs.frictionlessdata.io/table schema/>生成并加载bigquery表;`_描述符。
features
--
-实现``tableschema.storage``接口
这意味着主要的版本可能会包含破坏性的更改。强烈建议在"设置/要求"文件中指定"包"
版本范围,例如
"包">;=1.0,<;2.0`。
代码::bash
pip安装tableschema bigquery
开始使用google bigquery服务:
-创建新项目-
`link<;https://console.developers.google.com/home/dashboard>;`\br/>-创建服务密钥-
`link<;https://console.developers.google.com/api/credentials>;`您可以在
`examples<;https://github.com/frictionlessdata/tableschema bigquery py/tree/master/examples>;``uuuu
目录中看到更多示例。
代码::python
import io
import os
import json
from tableschema import table
from apiclient.discovery import build
from oauth2client.client import googlecredentials
os.environ['google_application_credentials']='.credentials.json'
credentials=googlecredentials.get_application_default()
service=build('bigquery','v2',credentials=credentials)
project=json.load(io.open('.credentials.json',encoding='utf-8'))['project_id']
#将表加载并保存到bigquery
table=table('data.csv',schema='schema.json')
table.save('data',storage='bigquery',service=service,project=project,dataset='dataset')
文档
----
并遵循
语义版本控制规则。本自述文件之外的所有内容都是私有的
API,可以在不通知任何新版本的情况下进行更改。
~`_
接口(请参阅链接上的完整文档):
前缀="")``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-``服务(对象)```服务``对象
-``项目(str)``-bigquery项目名称
-``数据集(str)`-bigquery数据集名称
-``前缀(str)`-所有前缀bucket
贡献
----
项目遵循"开放知识国际编码
标准<;https://github.com/okfn/coding standards>;`_.
建议开始的方法是创建并激活项目
虚拟环境。
将包和开发依赖项安装到活动
环境:
:
:
$make install
使用linting和coverage运行测试:
。代码:bash
$make test
在这个
阶段,它已经
安装到您的环境中,可以与文档中描述的更多
细粒度控制单独使用-
https://pylama.readthedocs.io/en/latest/
例如,按错误类型对结果排序:
。代码::bash
$pylama--sort<;path>;
已使用。
它已经安装到您的环境中,可以单独使用
并具有文档中所述的更细粒度控制
-https://testrun.org/tox/latest/
详细。
`--``之后的所有位置参数和选项都将传递给
``py.test`:
…代码::bash
tox-e py27--v tests/<;path>;
此软件包仅在tox
环境中可用。此处仅描述了中断和最重要的更改。所有已发布版本的完整
更改日志和文档可以在
格式良好的"提交
历史记录"中找到;https://github.com/frictionlessdata/tableschema bigquery py/commits/master>;` `。
~~~~
初始驱动程序实现。
| travis图像::https://img.shields.io/travis/friectionlessdata/tableschema bigquery py/master.svg
:目标:https://travis ci.org/friectionlessdata/tableschema bigquery py
。|工作服图片:http://img.shields.io/covertalls/frictionlessdata/tableschema-bigquery-py.svg?branch=master
:目标:https://coveralls.io/r/frictionlessdata/tableschema-bigquery-py?分支=主
…| pypi image::https://img.shields.io/pypi/v/tableschema bigquery.svg
:目标:https://pypi.python.org/pypi/tableschema bigquery
。| gitter图像::https://img.shields.io/gitter/room/friectionlessdata/chat.svg
:目标:https://gitter.im/friectionlessdata/chat
。|存储图像::https://i.imgur.com/rqgrxqp.png
===
pypi
gitter
基于"table
schema<;http://specs.frictionlessdata.io/table schema/>生成并加载bigquery表;`_描述符。
features
--
-实现``tableschema.storage``接口
这意味着主要的版本可能会包含破坏性的更改。强烈建议在"设置/要求"文件中指定"包"
版本范围,例如
"包">;=1.0,<;2.0`。
代码::bash
pip安装tableschema bigquery
开始使用google bigquery服务:
-创建新项目-
`link<;https://console.developers.google.com/home/dashboard>;`\br/>-创建服务密钥-
`link<;https://console.developers.google.com/api/credentials>;`您可以在
`examples<;https://github.com/frictionlessdata/tableschema bigquery py/tree/master/examples>;``uuuu
目录中看到更多示例。
代码::python
import io
import os
import json
from tableschema import table
from apiclient.discovery import build
from oauth2client.client import googlecredentials
os.environ['google_application_credentials']='.credentials.json'
credentials=googlecredentials.get_application_default()
service=build('bigquery','v2',credentials=credentials)
project=json.load(io.open('.credentials.json',encoding='utf-8'))['project_id']
#将表加载并保存到bigquery
table=table('data.csv',schema='schema.json')
table.save('data',storage='bigquery',service=service,project=project,dataset='dataset')
文档
----
并遵循
语义版本控制规则。本自述文件之外的所有内容都是私有的
API,可以在不通知任何新版本的情况下进行更改。
接口(请参阅链接上的完整文档):
前缀="")``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-``服务(对象)```服务``对象
-``项目(str)``-bigquery项目名称
-``数据集(str)`-bigquery数据集名称
-``前缀(str)`-所有前缀bucket
贡献
----
项目遵循"开放知识国际编码
标准<;https://github.com/okfn/coding standards>;`_.
建议开始的方法是创建并激活项目
虚拟环境。
将包和开发依赖项安装到活动
环境:
:
:
$make install
使用linting和coverage运行测试:
。代码:bash
$make test
在这个
阶段,它已经
安装到您的环境中,可以与文档中描述的更多
细粒度控制单独使用-
https://pylama.readthedocs.io/en/latest/
例如,按错误类型对结果排序:
。代码::bash
$pylama--sort<;path>;
已使用。
它已经安装到您的环境中,可以单独使用
并具有文档中所述的更细粒度控制
-https://testrun.org/tox/latest/
详细。
`--``之后的所有位置参数和选项都将传递给
``py.test`:
…代码::bash
tox-e py27--v tests/<;path>;
此软件包仅在tox
环境中可用。此处仅描述了中断和最重要的更改。所有已发布版本的完整
更改日志和文档可以在
格式良好的"提交
历史记录"中找到;https://github.com/frictionlessdata/tableschema bigquery py/commits/master>;` `。
初始驱动程序实现。
| travis图像::https://img.shields.io/travis/friectionlessdata/tableschema bigquery py/master.svg
:目标:https://travis ci.org/friectionlessdata/tableschema bigquery py
。|工作服图片:http://img.shields.io/covertalls/frictionlessdata/tableschema-bigquery-py.svg?branch=master
:目标:https://coveralls.io/r/frictionlessdata/tableschema-bigquery-py?分支=主
…| pypi image::https://img.shields.io/pypi/v/tableschema bigquery.svg
:目标:https://pypi.python.org/pypi/tableschema bigquery
。| gitter图像::https://img.shields.io/gitter/room/friectionlessdata/chat.svg
:目标:https://gitter.im/friectionlessdata/chat
。|存储图像::https://i.imgur.com/rqgrxqp.png