1. dbt Labs Documentation
"How we structure our dbt projects": This guide explicitly details the best practice of organizing models into directories. It states
"We structure our dbt projects into a few different directories... This structure helps us keep our project organized and easy to navigate." It specifically recommends staging
marts
and intermediate directories.
Source: dbt Labs Documentation > dbt Core > Guides > Best practice guides > How we structure our dbt projects.
2. dbt Labs Documentation
"About dbt projects": This section highlights the importance of directory structure. It notes
"The models/ directory is where you'll write the SQL (or Python) for the models that will make up your project... You can create subdirectories within the models/ directory to help you organize your models."
Source: dbt Labs Documentation > dbt Core > dbt projects > About dbt projects > Project structure.
3. dbt Labs Documentation
"Macros": The documentation introduces macros as a way to write reusable code. It states
"Macros in Jinja are pieces of code that can be called multiple times – they are analogous to 'functions' in other programming languages... Don't Repeat Yourself (DRY)." This directly supports the practice of modularization.
Source: dbt Labs Documentation > dbt Core > Jinja & macros > Macros.
4. dbt Labs Documentation
"Don't Repeat Yourself": This best practice guide explicitly advises against repeating code and promotes the use of macros. "If you find yourself copying and pasting SQL
consider creating a macro instead."
Source: dbt Labs Documentation > dbt Core > Guides > Best practice guides > Don't Repeat Yourself.