One of the key advantages of DBT is the modularisation aspect were it refers to the practice of breaking down complex data into smaller, more manageable pieces. The main way to do this is through building models and sources as seen in the lineage graph below.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-229.png)
Models
Models are SQL select tables in your DBT project. Each contain logic that will take the raw data and build it into the finished project.
Models are broken down into staging and marts models as seen in the models folder below.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-232.png)
Staging Models
Staging models are the first layer of transformation in your DBT pipeline. They contain
- Basic cleaning and preprocessing
- Basic transformations
- Low-level operations
They don't usually contain business logic and instead refine raw data to make it easier to work with in downstream (upcoming) models.
Building a model in DBT is very similar to SQL syntax (see below). Here we have labelled the file .sql which indicates the file contains SQL script and have used the same syntax as we would in any DBT database.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-230.png)
Marts Models
Marts represents a more refined, business layer of your DBT project and for the use of the analytics team to provide valuable insights. They usually contain:
- Business logic: aggregations and calculations
- Final datasets
Model Summary
Marts take data from the staging orders model (which is clean and processed) and then aggregates this data into the final report.
Sources
Sources represent the raw data that originates from databases before any transformation occurs. The sources functionality allows you to define these sources in a structured way, making it easy to reference them in your dbt models, track changes and ensure data integrity.
Sources are defined in a .yml file located in the models directory. Yml files define the schema and table name and allow for tests and documentation to be applied to the sources.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-233.png)
To then refer to a source in a model, you can use the same SQL syntax and state from {{ source('name', 'schema') }}