Project Strucuture
Anatomy of a dbt Project
dbt_project/
├── models/ # SQL transformations (core of your project)
├── analyses/ # One-off analytical queries
├── tests/ # Custom data tests
├── macros/ # Reusable SQL code blocks
├── snapshots/ # Historical data tracking definitions
├── seeds/ # CSV files to be loaded into the database
├── dbt_project.yml # Project configuration
├── packages.yml # External dependency definitions
└── README.md # Project documentationCore Components
Models Directory
-- models/marts/customers.sql
SELECT
c.customer_id,
c.name,
c.email,
COUNT(o.order_id) as number_of_orders,
SUM(o.amount) as total_order_value
FROM {{ ref('stg_customers') }} c
LEFT JOIN {{ ref('stg_orders') }} o ON c.customer_id = o.customer_id
GROUP BY 1, 2, 3Configuration Files
Source Definitions
Model Organization Patterns
Layered Approach
Layer
Purpose
Example
Typical Materialization
Domain-Based Organization
Working with Tests
Schema Tests
Singular Tests
Real-World Project Organization Example
Best Practices
Last updated
Was this helpful?