Updating dbt models

Introduction to dbt

Mike Metzger

Data Engineer

Why update?

  • Iterative work
  • Fixing bugs with queries / models
  • Migrating to different sources / destinations

SQL coding

1 Photo by Caspar Camille Rubin on Unsplash
Introduction to dbt

Update workflow

  1. Check out from source control
    • git clone dbt_project
  2. Find the model in question
  3. Update query contents
  4. Regenerate with
    • dbt run or
    • dbt run -f (Force full refresh)
  5. Check changes back to source control
Introduction to dbt

YAML files

  • Some updates may require changes to YAML / .yml files
  • Typically would require changes in:
    • dbt_project.yml
    • model_properties.yml

dbt_project.yml example

Introduction to dbt

dbt_project.yml

  • Contains mostly contents related to full project
    • Project name / version
    • Directory locations
  • Model materialization settings (global)
  • One dbt_project.yml file per project
Introduction to dbt

model_properties.yml

  • Contain settings that reference models
    • Description
    • Documentation details
    • Much more
  • Can actually be named anything (with .yml) in models/ subdirectory
  • Can have as many files as needed

model_properties.yml example

Introduction to dbt

Let's practice!

Introduction to dbt

Preparing Video For Download...