Skip to main content

Serverless Endpoint for dbt runs

GitHub Actions GitHub Actions Packaged with Poetry Code style: black Imports: isort Type checked with mypy codecov

PyPI Latest Release Package Status License

The goal of this project is to avoid the need of an Airflow server in order to schedule dbt tasks like runs, snapshots, docs...

It currently encapsulate few dbt commands into a FastAPI server which can be deployed on Cloud Run in a serverless fashion. That way we reduce costs as Cloud Run is terribly cheap!

You can also test it locally or through Docker without it being serverless, but it doesn't make sense as you already have the dbt CLI for this.

Usage

You'll need to make use of Google ADC (Authentification Default Credentials). Meaning either :

  • gcloud cli already identified
  • or a deployment through a google product with a service account having the roles/bigquery.admin
  • or a GOOGLE_APPLICATION_CREDENTIALS env variable for a specific local keyfile

Local deployment

With pip

pip install dbt-serverless
python run uvicorn dbt_serverless.main:app --host 0.0.0.0 --port 8080 --reload

With poetry

poetry add dbt-serverless
poetry run uvicorn dbt_serverless.main:app --host 0.0.0.0 --port 8080 --reload

Docker deployment

Simple docker image to build dbt-serverless for local or cloud run testing (for example).

ARG build_for=linux/amd64

FROM --platform=$build_for python:3.10-slim-bullseye

ARG DBT_PROJECT
ARG PROFILES_DIR

WORKDIR /usr/app

RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir dbt-serverless

COPY ${DBT_PROJECT}/ ${PROFILES_DIR}/profiles.yml ${DBT_PROJECT}/

ENTRYPOINT ["uvicorn", "dbt_serverless.main:app", "--host", "0.0.0.0", "--port", "8080"]

If you're not on a Google product (like Cloud Run), you will need to specify google creds at docker runtime.

For example you can add these cli parameters at runtime, if you're testing and deploying it locally :

    -v "$(HOME)/.config/gcloud:/gcp/config:ro" \
    -v /gcp/config/logs \
    --env CLOUDSDK_CONFIG=/gcp/config \
    --env GOOGLE_APPLICATION_CREDENTIALS=/gcp/config/application_default_credentials.json \
    --env GOOGLE_CLOUD_PROJECT=$(PROJECT_ID) \

Release files for dbt-serverless 0.1.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 dbt-serverless 0.1.2
File Size Uploaded
dbt_serverless-0.1.2.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbt-serverless 0.1.2
File Interpreter ABI Platform
dbt_serverless-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / dbt_serverless-0.1.2.tar.gz

Download URL dbt_serverless-0.1.2.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ce3e75597aba31b256959b6e9432a38ce23d9c49c211d2981ead424720b371c2
BLAKE2b-256 checksum
How to use checksums
d3b2a0a84517b3099b81e308086253672d413e10afeeac99ef4a8017dedd2640
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-1030-azure

Release files / dbt_serverless-0.1.2-py3-none-any.whl

Download URL dbt_serverless-0.1.2-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f115fd4f9fd30478317de6f48e3e92de0d2e108c6eac00d7fa3e8d3fdb8775c5
BLAKE2b-256 checksum
How to use checksums
dd51247a0477e2d01426855c3cc041f8cca8aa7cb8bf3af152799750c4ec0565
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.6 Linux/5.15.0-1030-azure

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

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