基于JSON Table Schema描述符生成BigQuery表,加载数据,提取数据。
项目描述
根据JSON Table Schema描述符生成和加载数据的BigQuery表。
版本 v0.3 包含重大更改
将 Storage.tables 重命名为 Storage.buckets
将 Storage.read 更改为读取到内存中
添加了 Storage.iter 以逐行生成
入门指南
安装
pip install jsontableschema-bigquery
存储
该软件包实现了 表格存储 接口。
要开始使用Google BigQuery服务
我们可以这样获得存储
import io
import os
import json
from apiclient.discovery import build
from oauth2client.client import GoogleCredentials
from jsontableschema_bigquery import Storage
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']
storage = Storage(service, project, 'dataset', prefix='prefix')
然后我们可以与存储进行交互
storage.buckets
storage.create('bucket', descriptor)
storage.delete('bucket')
storage.describe('bucket') # return descriptor
storage.iter('bucket') # yields rows
storage.read('bucket') # return rows
storage.write('bucket', rows)
映射
schema.json -> bigquery table schema data.csv -> bigquery talbe data
驱动程序
默认使用Google BigQuery客户端 - 文档。
API参考
快照
https://github.com/frictionlessdata/jsontableschema-py#snapshot
详细
贡献
请阅读贡献指南
谢谢!
项目详情
关闭
jsontableschema-bigquery-0.5.0.tar.gz的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2aa5db666d81c652aa3a0cc6ffc7d5a668518a2455b9901d44f82af0f7d77197 |
|
MD5 | d545c1d3c8dc1f029b66bc541f8b8983 |
|
BLAKE2b-256 | 07e6acc1ca3ef200c44967705c16f7c2db0c8dd9a8c274786e3b74f4eafa393c |
关闭
jsontableschema_bigquery-0.5.0-py2.py3-none-any.whl的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | ab26f4b081130675b7ec0b2f55ecf047ad840a8493a990a93d3356f3ad6a053e |
|
MD5 | a00d2925498046f38be74fe091497aa8 |
|
BLAKE2b-256 | 5808efcf7dab5af14aa683d67c519a0f6235c3c940d8d7dbd877093d891f5dc2 |