dbt (Data Build Tool) Explained — Quick Answer
dbt is an open-source SQL-first transformation framework for analytics engineering. You write SELECT statements (with Jinja templating), and dbt handles materialisation (table, view, incremental), testing, documentation, and lineage. dbt is the de facto standard for the "T" in ELT pipelines on Snowflake, BigQuery, Redshift, and Databricks. The dbt Analytics Engineer Certification is the most common credential.
What dbt Does
| Capability | How It Works |
|---|---|
| Models | SELECT statements → tables, views, or incremental models |
| Tests | not_null, unique, relationships, custom SQL tests |
| Snapshots | Capture slowly-changing dimensions (Type 2 SCD) |
| Macros | Reusable Jinja snippets for SQL generation |
| Documentation | YAML descriptions + auto-generated docs site |
| Lineage | Automatic DAG of model dependencies |
| Seeds | Load CSV files as tables |
Sample dbt Model
-- models/staging/stg_orders.sql
{{ config(materialized='incremental',', unique_key='order_id') }}
SELECT
order_id,
customer_id,
order_date,
total_amount,
status
FROM {{ source('raw', 'orders') }}
{% if is_incremental() %}
WHERE order_date > (SELECT MAX(order_date) FROM {{ this }})
{% endif %}
This model reads from a source, materialises incrementally, and only processes new rows on subsequent runs.
dbt Core vs dbt Cloud
| Feature | dbt Core | dbt Cloud |
|---|---|---|
| Cost | Free | Developer plan free; Team from $100/dev/month; Enterprise from $400/dev/month |
| Where It Runs | Your machine / CI | Managed SaaS |
| UI | CLI only | Web UI + CLI |
| Scheduler | No (use Airflow/Cron) | Built-in |
| CI/CD | DIY | Native (PR triggers, slim CI) |
| Observability | No | Built-in (dbt Explorer, alerts) |
| Documentation | Auto-generated | Hosted + auto-generated |
Most teams use dbt Core locally for development and dbt Cloud for production. The Cloud Developer plan is free for one developer.
dbt Project Structure
my_dbt_project/
├── dbt_project.yml
├── models/
│ ├── staging/
│ │ ├── stg_orders.sql
│ │ └── stg_customers.sql
│ └── marts/
│ └── customer_orders.sql
├── tests/
│ └── assert_positive_amount.sql
├── macros/
│ └── cents_to_dollars.sql
├── seeds/
│ └── country_codes.csv
└── snapshots/
└── customer_snap.sql
dbt + ELT Workflow (Typical)
- Extract: Fivetran, Airbyte, or custom pipeline loads raw data into the warehouse.
- Load: Raw data lands in raw.orders, raw.customers (in Snowflake/BigQuery).
- Transform with dbt: Staging models clean the data. Mart models aggregate and join for analytics.
- Test: dbt tests catch data quality issues.
- Serve: BI tools (Looker, Tableau, Power BI, Mode) connect to the mart tables.
dbt Certifications (2026)
- dbt Analytics Engineer Certification: The official dbt Cloud cert. Covers models, tests, macros, sources, deployments, and Jinja. ~$200 USD per attempt.
- dbt Trainings: Free courses at learn.getdbt.com + paid workshops.
dbt vs Airflow — Complementary Tools
| Tool | What It Does | When to Use |
|---|---|---|
| dbt | SQL transformations in the warehouse | Always, for the "T" step |
| Airflow | Orchestrate workflows across systems | Always, for scheduling + orchestration |
| Both | Airflow triggers dbt runs as a task in a DAG | Best practice |
Common dbt Real-World Example — A Production dbt Project
Here is what a mature dbt project looks like at a data-driven company:
- Sources: 30+ raw tables from Fivetran (Stripe, Salesforce, HubSpot, Postgres RDS).
- Staging models (stg_): 50+ models that clean and rename raw fields.
- Intermediate models (int_): 20+ models that join related entities (customers, orders, products).
- Mart models (mart_): 30+ fact and dimension tables for BI consumption.
- Tests: 500+ data quality tests across all models.
- Documentation: YAML descriptions on every model and column.
- Snapshots: Slowly-changing dimensions for customer and product attributes.
- Macros: Reusable macros for cents-to-dollars, date formatting, and pivot logic.
Running dbt on a project of this size takes 1–2 hours and produces 50+ transformed tables ready for BI consumption.
PitfallsWatch out for these traps when adopting dbt:
- No tests on critical models: Every mart model should have at minimum not_null and unique tests on primary keys.
- Long dependency chains: If model A depends on B which depends on C... rebuilding A is slow. Keep chains shallow.
- Hardcoding source names: Use sources in dbt, not hardcoded table names. Sources enable env-specific config.
- No documentation: dbt's auto-generated docs site is only useful if you write YAML descriptions. Document every model and column.
- Skipping staging layer: Always have a staging layer (stg_) that cleans raw data, and a marts layer that joins/aggregates. Skipping the staging layer creates brittle marts.
Quick Reference — Cheatsheet
- dbt = SELECT statements + Jinja templating + materialisation.
- Use incremental models for large fact tables — full refresh only for small dimensions.
- Tests are data quality contracts — fail the build on broken tests.
- dbt Cloud Developer plan is free for 1 developer.
- Use macros for repeated SQL patterns — DRY principle for transformations.
Frequently Asked Questions
What is dbt?
An open-source SQL-first transformation framework. Write SELECT statements with Jinja templating; dbt handles materialisation, testing, documentation, and lineage.
What is the difference between dbt Core and dbt Cloud?
dbt Core: CLI, free. dbt Cloud: managed SaaS with UI, scheduler, CI/CD, observability.
What databases does dbt support?
Snowflake, BigQuery, Redshift, Databricks, Postgres, MySQL, Spark, Trino, and more.
What are dbt models, tests, snapshots, and macros?
Models: SELECT → table/view. Tests: data quality checks. Snapshots: SCD Type 2. Macros: reusable Jinja snippets.
Is dbt a replacement for Airflow?
No — complementary. Airflow orchestrates the workflow; dbt handles SQL transformations. Airflow often triggers dbt runs.
What dbt certifications are available?
dbt Analytics Engineer Certification. Plus free + paid training at learn.getdbt.com.






