dbt Best Practices for Analytics Engineering
How to structure models, tests, and docs so your dbt project stays maintainable and reliable.
Layer your models
Use a clear layering strategy: staging (raw data cleaned and renamed), intermediate (business logic, joins, one concept per model), and marts (final tables for analytics or tools). Staging models should only reference sources; intermediate and marts reference other models with ref(). This keeps the DAG understandable and makes it easier to debug and change one layer without breaking others.
Test and document everything
Add schema tests (e.g. unique, not_null, relationships) to critical columns so dbt can catch bad data. Use custom data tests (SQL that returns failing rows) for business rules. Document every model and key columns in YAML so dbt docs gives your team a single place to see what each table means and how it’s built. Good tests and docs turn your project into a reliable, self-describing asset.
Use incremental and ephemeral where it fits
For large fact tables, use incremental models so only new or updated data is processed. Choose a strategy (append vs. merge) and a filter (e.g. incremental_strategy='merge' with a unique key). For models that are only used as building blocks and don’t need to persist, use materialized='ephemeral' to reduce clutter and build time. On Snowflake, merge-based incrementals and clustering can keep query performance high as data grows.
Need a stronger dbt development workflow?
Kundul helps teams improve dbt project structure, testing, governance, and Snowflake delivery so analytics engineering stays reliable as you scale.
Book a call