Skip to content

A template repository for deploying DBT to Cloud Run

Notifications You must be signed in to change notification settings

bparbhurestore/dbt-cloud-run-template

 
 

Repository files navigation

DBT Cloud Run Template

Key Contacts

Pre-requisites

There are several ways to recreate this article but to follow along line for line you will need:

Getting Started

Let's create a new conda environment with dbt-bigquery and Flask.

conda create -n dbt-cloud-run pip
conda activate dbt-cloud-run
pip install dbt-bigquery
pip install google-cloud-logging
pip install Flask

Update your DBT Profile

Update dbt/profiles.yml with YOUR_DATASET and YOUR_PROJECT.

YOUR_DBT_PROJECT:
  target: dev
  outputs:
    dev:
      dataset: YOUR_DATASET
      job_execution_timeout_seconds: 300
      job_retries: 1
      location: EU
      method: oauth
      priority: interactive
      project: YOUR_PROJECT
      threads: 4
      type: bigquery
    prod:
      dataset: YOUR_DATASET
      job_execution_timeout_seconds: 300
      job_retries: 1
      location: EU
      method: oauth
      priority: interactive
      project: YOUR_PROJECT
      threads: 4
      type: bigquery

Deploy App to Cloud Run

SERVICE_ACCOUNT=YOUR_SERVICE_ACCOUNT
SERVICE_NAME=YOUR_SERVICE_NAME # e.g. dbt-daily
REGION=YOUR_REGION # e.g. europe-west2

gcloud builds submit \
  --tag gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}

gcloud run deploy ${SERVICE_NAME} --region $REGION \
    --image gcr.io/$(gcloud config get-value project)/${SERVICE_NAME} \
    --service-account ${SERVICE_ACCOUNT}@$(gcloud config get-value project).iam.gserviceaccount.com \
    --platform managed \
    --no-allow-unauthenticated

About

A template repository for deploying DBT to Cloud Run

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 36.6%
  • Python 21.7%
  • CSS 21.2%
  • Shell 13.9%
  • Dockerfile 6.0%
  • Procfile 0.6%