Easily integrate data in BigQuery
Project description
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 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
Project details
Release history Release notifications | RSS feed
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.23.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.23-py3-none-any.whl
(10.8 kB
view details)
File details
Details for the file pygbq-0.23.tar.gz.
File metadata
- Download URL: pygbq-0.23.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 |
d4825398ba77a0aa556693c694ee051ac222229504d5656d61ac9048e2ec4446
|
|
| MD5 |
197762acdcb159eedfc0cce25ae38a17
|
|
| BLAKE2b-256 |
6ce98d1f2d7bd1e23df1cb6dc380d9a248fc802e3f9ceeb4d2586dec0483263d
|
File details
Details for the file pygbq-0.23-py3-none-any.whl.
File metadata
- Download URL: pygbq-0.23-py3-none-any.whl
- Upload date:
- Size: 10.8 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 |
c8105d1d18c265527b03db85f4379a23e2745a2a0d2bf6f56e6ff7916023062f
|
|
| MD5 |
cfdaec3f9ee713f71aa1b15cd030c75f
|
|
| BLAKE2b-256 |
098aa574a7931d5fa4d55f27ba5a6a5d90ae68ae866cfd2f0e17345f79ae50f5
|