Skip to main content

A Simple Google BigQuery ETL

Tired of messy execution pipelines? Drop a few .sql files into a directory, e.g. foo.sql, bar.sql and call executeTemplates() with some parameters. It will resolve dependencies between these SQL statements, execute them in correct order sending the output to a table with a unique name which includes the hash of the SQL. If the table already exists, it will not be executed again. Tables will eventually expire so you do not need to worry about deleting them.

For more details see example directory.

The only dependencies of this package are google-cloud-bigquery and google-cloud-storage.

It is purposely made bare-bones. If you want a feature such as a specific export format other than .csv.gz, etc. - pull requests are more than welcome.

Installation

  pip install bq_etl

Description

A module to execute BigQuery ETL jobs comprising of multiple interdependent SQL statements with no configuration other than the SQL itself. It can infer dependencies, execute the SQL in correct order, and optionally extract and download the table data.

Similarly to how compilers compile programs, if any of the steps (execution, extract or download) are already completed, they are not repeated again. This module does not need any external tools or configuration to keep track of its state - it is entirely based on what is in BigQuery, GCS or your local filesystem.

The key hack is that the actual BigQuery output table names are postfixed with short hashes of the SQL statements thereby making them unique and specific to the tables. Changing the SQL will result in a different table name.

License

Apache 2.0

Release files for bq-etl 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bq-etl 0.0.2
File Size Uploaded
bq_etl-0.0.2.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bq-etl 0.0.2
File Interpreter ABI Platform
bq_etl-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.7 kB

Release files / bq_etl-0.0.2.tar.gz

Download URL bq_etl-0.0.2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
24b0677c19a0a4ba16b1306d9fa3a32125048c8565a51c23455c3bd0b8f66f9f
BLAKE2b-256 checksum
How to use checksums
844a10be7275508abe061f7eeb2401c2d833f755ed0be99d4b463d7a2a50419b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

Release files / bq_etl-0.0.2-py3-none-any.whl

Download URL bq_etl-0.0.2-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4709d15c55deaddfbcb9b1e854231d6e16fb661b39838698a59d2be3c8678f79
BLAKE2b-256 checksum
How to use checksums
a1267eedab87661613241a6353a3a19e6fa0479b8e6ef5b7a5d5e96cfe5adcad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page