dbt Data Transformation Workflow
Explain how dbt works and its role in the modern data stack.
What Is dbt
dbt (data build tool) is a SQL-first transformation framework that lets data engineers write version-controlled, testable transformation logic using SQL and Jinja templates.
Core Concepts
Model: Each .sql file defines a SELECT statement. dbt compiles it into a CREATE TABLE AS or CREATE VIEW AS statement and runs it in the warehouse.
Materialization Types:
- view: SQL executes at query time; no data stored.
- table: Results stored as a physical table; fast queries but full rebuild each run.
- incremental: Only processes new/updated data; suitable for large tables.
Ref Function: {{ ref("model_name") }} references other models; dbt automatically resolves dependency order.
Tests: Declarative data quality checks (not_null, unique, accepted_values).
Documentation: Auto-generates lineage graphs and a data dictionary.
Layer Architecture
Staging (raw cleaning) → Intermediate (business logic) → Marts (analyst-facing final tables).
✦ AI Mock Interview
Type your answer and get instant AI feedback
Sign in to use AI scoring
