Metadata-Version: 2.1
Name: pygbq
Version: 0.23
Summary: Easily integrate data in BigQuery
Home-page: https://github.com/ZiggerZZ/pygbq
Author: Zigfrid Zvezdin
Author-email: ziggerzz@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: pandas
Requires-Dist: pandas-gbq
Requires-Dist: pytz
Requires-Dist: google-auth
Requires-Dist: google-cloud-bigquery
Requires-Dist: google-cloud-logging
Requires-Dist: google-cloud-secret-manager
Requires-Dist: bigquery-schema-generator
Requires-Dist: tqdm
Requires-Dist: pyarrow

# PyGBQ

> Easily integrate data in BigQuery

## Example

The following snippet

```python
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](https://cloud.google.com/docs/authentication/getting-started).

## 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 
and `how=['field1', 'field2']` to upsert by `field1` and `field2`  
* 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

