Skip to main content

Generate BigQuery tables, load and extract data, based on JSON Table Schema descriptors.

Project description

Travis
Coveralls
PyPi
SemVer
Gitter

Generate and load BigQuery tables based on JSON Table Schema descriptors.

Version v0.3 contains breaking changes:

  • renamed Storage.tables to Storage.buckets

  • changed Storage.read to read into memory

  • added Storage.iter to yield row by row

Getting Started

Installation

pip install jsontableschema-bigquery

Storage

Package implements Tabular Storage interface.

To start using Google BigQuery service:

  • Create a new project - link

  • Create a service key - link

  • Download json credentials and set GOOGLE_APPLICATION_CREDENTIALS environment variable

We can get storage this way:

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')

Then we could interact with storage:

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)

Mappings

schema.json -> bigquery table schema
data.csv -> bigquery talbe data

Drivers

Default Google BigQuery client is used - docs.

API Reference

Snapshot

https://github.com/frictionlessdata/jsontableschema-py#snapshot

Detailed

Contributing

Please read the contribution guideline:

How to Contribute

Thanks!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsontableschema-bigquery-0.3.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

jsontableschema_bigquery-0.3.0-py2.py3-none-any.whl (9.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jsontableschema-bigquery-0.3.0.tar.gz.

File metadata

File hashes

Hashes for jsontableschema-bigquery-0.3.0.tar.gz
Algorithm Hash digest
SHA256 42952ba2ac4b7d7ca1f23e920b63aa9d256002d86137cc4b8f3346b0409573dd
MD5 9363a3902bd120f3727cc98d82f0ba84
BLAKE2b-256 46391c96a01b78ff261b9d63db42bda9d5b23247396b23275c0bb4573cc1e0c5

See more details on using hashes here.

Provenance

File details

Details for the file jsontableschema_bigquery-0.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for jsontableschema_bigquery-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9843c495120ad3b16ea033a9f1da0ae63bd65829c8b76c25d51a34f4509576cf
MD5 ab37e5cc55963d4ee551e834b612f63b
BLAKE2b-256 331435797ba28d2f022eb3096b84ee6be7d43b6786791870a6ae3c76b923dbe4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page