Skip to main content

BigQuery Python Library

Project description

bqlib - BigQuery Python Library

BigQuery Python Library

See: Google BigQuery

Requirements

  • Python 2.6 or later (not support for 3.x)

Setup

$ pip install bqlib

How to use

Single Query - BQJob

BQJob is a class for starting the BigQuery job and fetching the result.
You can use either run_sync(synchronous) or run_async(asynchronous) method.
from bqlib import BQJob

project_id = 'example_project'
query = 'SELECT foo FROM bar'
http = authorized_http

bqjob = BQJob(http, project_id, query=query)

# run synchronously
job_result = bqjob.run_sync()

# or run asynchronously
bqjob.run_async()
# ... do other things ...

job_result = bqjob.get_result()

print job_result # [{u'foo': 10}, {u'foo': 20}, ...]

Multiple Queries - BQJobGroup

BQJobGroup is a class for putting multiple BQJobs into an one group.
Each BQJob in that group are executed concurrently.
from bqlib import BQJob, BQJobGroup

bqjob1 = BQJob(http, project_id, query=query)
bqjob2 = BQJob(http, project_id, query=query)

job_group = BQJobGroup([bqjob1, bqjob2])
# synchronously
results = job_group.run_sync()

# or asynchronously
job_group.run_async()
# ... do other things ...

results = job_group.get_results()

print results # [[{'foo': 10}, {'foo': 20}], [{'bar': 'test'}]]

Note

  • Concurrent Requests to BigQUery
    • Concurrent requests to BigQuery is restricted to 20 requests by Quota Policy.

    • If you want to set up concurrent requests to 20, you also have to set up at traffic controls in api-console page.

License

This library is disributed as MIT license.

History

2013-10-22 bqlib 0.0.1

  • First release

2014-03-18 bqlib 0.0.2

  • Bug fixes

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

bqlib-0.0.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distributions

bqlib-0.0.2.macosx-10.9-intel.tar.gz (9.4 kB view details)

Uploaded Source

bqlib-0.0.2-py2.7.egg (11.2 kB view details)

Uploaded Source

File details

Details for the file bqlib-0.0.2.tar.gz.

File metadata

  • Download URL: bqlib-0.0.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bqlib-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0ee164c2c9572b4c48f65c94085e5ded24e5bc85d57bcfa004057e11c348b3e7
MD5 1c2e52efe379364e6c556bcb5b168830
BLAKE2b-256 61fd2cd54a05f5e951ca65d4bc03ed7a0e30a3b5d0cf0f05d9bd2341bf4ff9dc

See more details on using hashes here.

File details

Details for the file bqlib-0.0.2.macosx-10.9-intel.tar.gz.

File metadata

File hashes

Hashes for bqlib-0.0.2.macosx-10.9-intel.tar.gz
Algorithm Hash digest
SHA256 637372b7f7a9a2ce7e673952d762c7b362e8125d86900433cea8f52fbd690823
MD5 fcb027f4e1ba188843e2865b86f420a9
BLAKE2b-256 750ed9b76bec4a08609be2437f333ad2f8fa9fbe649ef0040b47a8c1c00ad5d1

See more details on using hashes here.

File details

Details for the file bqlib-0.0.2-py2.7.egg.

File metadata

  • Download URL: bqlib-0.0.2-py2.7.egg
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bqlib-0.0.2-py2.7.egg
Algorithm Hash digest
SHA256 bf09629506669271e4ee532f01ab7172ecea9e0c390608bb68ff314ca8bc9b26
MD5 40b5f3c6061ce33c2a1275effddfd1f5
BLAKE2b-256 b5f5d3f9a4450dd95099a5cb2ba0b3b3d285b6b9e2ade91d705e4a24ab85cd41

See more details on using hashes here.

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