Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies...
Production-ready patterns for dbt (data build tool) including model organization, testing strategies, documentation, and incremental processing.
sources/ Raw data definitions
ā
staging/ 1:1 with source, light cleaning
ā
intermediate/ Business logic, joins, aggregations
ā
marts/ Final analytics tables
| Layer | Prefix | Example |
|---|---|---|
| Staging | stg_ |
stg_stripe__payments |
| Intermediate | int_ |
int_payments_pivoted |
| Marts | dim_, fct_ |
dim_customers, fct_orders |
# dbt_project.yml
name: "analytics"
version: "1.0.0"
profile: "analytics"
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
vars:
start_date: "2020-01-01"
models:
analytics:
staging:
+materialized: view
+schema: staging
intermediate:
+materialized: ephemeral
marts:
+materialized: table
+schema: analytics
# Project structure
models/
āāā staging/
ā āāā stripe/
ā ā āāā _stripe__sources.yml
ā ā āāā _stripe__models.yml
ā ā āāā stg_stripe__customers.sql
ā ā āāā stg_stripe__payments.sql
ā āāā shopify/
ā āāā _shopify__sources.yml
ā āāā stg_shopify__orders.sql
āāā intermediate/
ā āāā finance/
ā āāā int_payments_pivoted.sql
āāā marts/
āāā core/
ā āāā _core__models.yml
ā āāā dim_customers.sql
ā āāā fct_orders.sql
āāā finance/
āāā fct_revenue.sql
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
{{ var('start_date') }}