A client library for running dbt projects on Google Cloud Run
Project description
dbt-cloud-run-runner
A Python client library for running dbt projects on Google Cloud Run.
Installation
pip install dbt-cloud-run-runner
Usage
from dbt_cloud_run_runner import Client
# Initialize the client
client = Client(
gcp_project="your-gcp-project",
gcs_bucket="your-gcs-bucket",
region="us-central1", # optional, defaults to us-central1
)
# Prepare a dbt project for BigQuery
setup = client.prepare_bigquery(
service_account_key={"type": "service_account", ...}, # Your service account key JSON
target_project="your-bigquery-project",
target_dataset="your_dataset",
path_to_local_dbt_project="./path/to/dbt/project",
image="us-docker.pkg.dev/delphiio-prod/public-images/dbt-runner:v0.0.7",
)
# Run the dbt project on Cloud Run
execution_id = client.run(setup)
print(f"Execution started: {execution_id}")
# Wait for completion
status = client.wait_for_completion(execution_id)
print(f"Execution finished with state: {status.state.value}")
# Or poll status manually
status = client.get_status(execution_id)
print(f"Current state: {status.state.value}")
Features
- Automatic GCS setup: Uploads your dbt project and credentials to GCS with signed URLs
- Cloud Run job management: Creates and manages Cloud Run jobs automatically
- BigQuery integration: Generates
profiles.ymlfor BigQuery targets - Status monitoring: Track execution status with polling or wait for completion
Requirements
- Python 3.9+
- Google Cloud project with Cloud Run and GCS enabled
- Service account with appropriate permissions:
- Cloud Run Admin (
roles/run.admin) - Storage Admin (
roles/storage.admin) on the GCS bucket - BigQuery access for the target project/dataset
- Cloud Run Admin (
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
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
File details
Details for the file dbt_cloud_run_runner-0.1.0.tar.gz.
File metadata
- Download URL: dbt_cloud_run_runner-0.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
700bf99510871f3fcaf134982daa25b2fd0e0320055dd5aa17c0be5ed54f6089
|
|
| MD5 |
39a2f6ababb266e0d507cc6995db3453
|
|
| BLAKE2b-256 |
250a0541ec121f2ee3f9d1389d2f547d7ea3757b725752c638fb34b291d449c6
|
File details
Details for the file dbt_cloud_run_runner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dbt_cloud_run_runner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d30638c4c147cd01f80e55ac17eecf3161fbbfddacb8379697f21938da9cdb4e
|
|
| MD5 |
1b79eb2073d95d38a430309b0b90bf82
|
|
| BLAKE2b-256 |
335089df23f133a87f2d1821f3a6bf35519f69b60dd9878feca99acc04177e38
|