Welcome to the first edition of “Andreas takes you on the ride while he learns how to do his job.” Today, we’re diving into dbt (Data Build Tool) to understand its core concepts, project structure, and key components. Whether you’re new to dbt or looking to solidify your understanding, this guide will help you go from zero to hero.

What is dbt?

Dbt, short for Data Build Tool, is a command-line tool that enables data analysts and engineers to transform data in their warehouse more effectively. It allows you to write modular SQL queries, version control your transformations, and document your data in a consistent, reproducible manner. Dbt empowers data teams to own the entire analytics engineering workflow, from transforming raw data to creating clean, actionable insights.

Core Concepts of dbt

Before we delve into the project structure, let’s cover some core concepts:


In dbt, a model is simply a SQL file that contains a select statement. Models are the building blocks of your dbt project. Each model file typically represents a transformation step, from raw data to clean, transformed data ready for analysis.


Sources refer to the raw data tables in your database. Defining sources helps you keep track of the origin of your data and ensures consistency in how you refer to them across your project.


Seeds are CSV files that you can load into your data warehouse. These files can be used to manage reference data, small lookup tables, or any static data you need in your transformations.


Tests in dbt help you validate your data. You can write custom SQL tests or use built-in tests to ensure data quality and integrity. Common tests include checking for null values, uniqueness, and referential integrity.


Documentation is an integral part of dbt. You can document your models, sources, and tests using YAML files. Dbt also provides a web-based interface to view your documentation and understand your data lineage.


Materializations determine how dbt will build your models in the data warehouse. Common materializations include views, tables, and incremental tables. Each has its own use case, depending on the size of your data and performance requirements.

Exploring dbt’s Project Structure

A dbt project is organized in a specific structure to facilitate modular, scalable, and maintainable code. Here’s a typical layout of a dbt project:


├── models/
│   ├── marts/
│   │   ├── finance/
│   │   │   ├── fct_orders.sql
│   │   │   ├── fct_revenue.sql
│   │   └── marketing/
│   │       ├── fct_campaigns.sql
│   │
│   ├── staging/
│   │   ├── stg_customers.sql
│   │   ├── stg_orders.sql
│   │
│   └── intermediate/
│       ├── int_customers.sql
│       ├── int_orders.sql

├── seeds/
│   ├── countries.csv
│   ├── currency_rates.csv

├── tests/
│   ├── unique_orders.sql
│   ├── not_null_customers.sql

├── macros/
│   ├── my_macro.sql

├── snapshots/
│   ├── customers_snapshot.sql

├── analyses/
│   ├── customer_lifetime_value.sql

├── docs/
│   ├── index.md

└── dbt_project.yml

Key Components

  1. Models: This is where you define your SQL transformations. They are typically organized into subfolders like marts, staging, and intermediate to represent different stages of your data pipeline.

  2. Seeds: These are CSV files that dbt loads into your warehouse. They can be found in the seeds folder.

  3. Tests: Tests help ensure data quality. You can define them in the tests folder.

  4. Macros: Macros are reusable SQL snippets or functions. You define them in the macros folder.

  5. Snapshots: Snapshots track changes to your data over time. They are useful for slowly changing dimensions and can be found in the snapshots folder.

  6. Analyses: This folder contains ad-hoc queries or analyses that you want to perform. They don’t typically contribute to your data pipeline but are useful for data exploration.

  7. Docs: Documentation files go here. dbt will render these documents in a web-based interface for easy access.

  8. dbt_project.yml: This is the configuration file for your dbt project. It defines the project’s settings, such as model materializations, seeds, and more.

Getting Started with dbt

To get started with dbt, follow these steps:

  1. Install dbt: Install dbt using pip:
pip install dbt
  1. Initialize a dbt Project: Create a new dbt project by running:
dbt init my_project
  1. Configure Your Project: Edit the dbt_project.yml file to set up your project’s configurations.
  2. Create Models: Add your SQL transformation files in the models folder.
  3. Run Your Project: Execute your dbt project by running:
dbt run
  1. Test Your Models: Validate your transformations by running:
dbt test
  1. Generate Documentation: Create documentation for your project by running:
dbt docs generate
  1. View the documentation with:
dbt docs serve


Dbt is a powerful tool for data transformation and management. By understanding its core concepts, exploring its project structure, and leveraging its key components, you can transform raw data into actionable insights more effectively. Remember, dbt encourages a modular, iterative workflow, making your data transformations more maintainable and scalable.

Tune in for the next dummies post coming soon. If you also stick around for my non-dbt related writing, I appreciate you. It doesn’t always feel right to promo those posts on LinkedIn, so I am grateful for those of you that read them anyways.

Subscribe to the RSS feed, tell your friends, you know the drill. Thanks for reading.