PyGBQ
Easily integrate data in BigQuery
Example
The following snippet
from pygbq import Client
import requests
client = Client(default_dataset='Finance')
def transactions(start_date):
data = requests.get(url='some/api/endpoint', headers={'start_date': start_date}).json()
client.update_table_using_temp(data=data, table_id='transactions', how=['id'])
return {'status': 200}
if __name__ == "__main__":
transactions("2020-11-25")
will upsert data to table Finance.transactions by id.
Install and set up
pip install pygbq
Set up the authentication.
Documentation
- Client - you can set
default_dataset,save_dir,path_to_key - Client.update_table_using_temp - the main update function, use
how='insert'to insert data andhow=['field1', 'field2']to upsert (merge) byfield1andfield2 - read_jsonl - read newline delimited json
- Client.get_secret - get a secret version from Secret Manager
- Client.add_secret - add a secret version to Secret Manager
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pygbq-0.24.tar.gz
(9.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pygbq-0.24-py3-none-any.whl
(10.7 kB
view details)
File details
Details for the file pygbq-0.24.tar.gz.
File metadata
- Download URL: pygbq-0.24.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
177adf6b2bcb20d618e43fca4c2449f854a374d29dddcc73cb4b390cc53c42d6
|
|
| MD5 |
632559f03c1691869b02dde2722a93d9
|
|
| BLAKE2b-256 |
9dd5f519ec2056189f525edac0c5b5c002f616656a64f73ed25e3253ee041caa
|
File details
Details for the file pygbq-0.24-py3-none-any.whl.
File metadata
- Download URL: pygbq-0.24-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc074a130c837e1f2eed1edeca395f0037e4149097987ecc92bf4a93e7939b0f
|
|
| MD5 |
0ea1039bf9522fe2bacd1c17f63bca70
|
|
| BLAKE2b-256 |
0664c3132d2aeaf439de1445c3348ea0b35fdc7fce7ff52a702755a33f336782
|