dbt (data build tool) lets analysts and engineers write transformations as SELECT statements while dbt handles dependency ordering, materialization, testing and documentation. It turns a warehouse full of ad-hoc SQL into a maintainable codebase.
A project structure that scales
models/
staging/ -- one model per source table: rename, type-cast, filter
intermediate/ -- reusable joins and business logic
marts/
finance/
procurement/
inventory/
sales/This maps directly onto the Medallion pattern: staging is silver, and marts are gold.
Tests are cheap insurance
models:
- name: fct_purchases
columns:
- name: invoice_id
tests: [unique, not_null]
- name: supplier_key
tests:
- relationships:
to: ref('dim_supplier')
field: supplier_keyRun tests with every build so broken data is caught before it reaches a dashboard.
Use ref() and source() everywhere
They create the lineage graph, make environments switchable and let dbt build models in the right order.
Document for both audiences
Model and column descriptions in YAML generate a browsable documentation site. It is useful for technical teams and for business users who want to know what a metric means.
- dbt
- SQL
- Data Quality
