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
Tasks
def create_task(url, queue, payload, task_name=None, in_seconds=None):
returns Response
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.2.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f5afeac2765e6f681a52a4e093f9095fa10e54fbf5fdcadec65d36c48ec3c3 |
|
MD5 | 7158c72f3075f34b3d21811d46b4d18c |
|
BLAKE2b-256 | 5c4dd8205eb9bcf16aebfb3ca96e02ee357093b0d479da96253c2a3e355f5846 |