Vakanties.nl pypi package
Project description
Vaknl-gcp
Package for working with dataclasses and Google cloud instances as Bigquery and Storage. For this to work the dataclasses need to contain only basic python variables as: str, int, dict, list etc.
Prerequisites
These modules dependant on the environment variable GOOGLE_CLOUD_PROJECT a.k.a. gcp project id.
Bigquery
execute_query(query):
Execute query and log errors
returns query_job
stream_to_bigquery(objects: list, table_ref):
Cast python objects to json and stream them to GBQ Note: this is more expensive compared to using buckets but also quicker
returns table ref
write_disposition_bucket(table_ref, blob_name, write_disposition):
Get data from bucket to GBQ using a write_disposition method
Requires: bucket with name storage_to_bigquery-[project-id]
- WRITE_DISPOSITION_UNSPECIFIED Unknown.
- WRITE_EMPTY This job should only be writing to empty tables.
- WRITE_TRUNCATE This job will truncate table data and write from the beginning.
- WRITE_APPEND This job will append to a table.
returns load_job.result
Storage
storage_to_bigquery(objects: list, table_ref, write_disposition):
Function that stores data into multiple storage blobs. Afterwards these wil be composed into one storage blob The reason for this process is to downsize the sie of the data send to Google Cloud Storage.
Requires: bucket with name storage_to_bigquery-[project-id]
get_bucket(name_bucket: str):
returns name_bucket
get_blobs_from_bucket(bucket):
returns blobs:list
upload_from_string(blob, string):
returns blob.public_url
Secrets (beta)
get_secret(secret_id):
returns json
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
Built Distribution
Hashes for vaknl_gcp-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 081ff356f7cfac27030313c050362c00381db2547020c809bb821cb1c6c534e0 |
|
MD5 | 81c7ac1ed928416157ade0651c1744d8 |
|
BLAKE2b-256 | d5e285f3a917a1751a4e39c3f338d6909c70de72c76dbe9fb16a3908dbc62718 |