DBT Getting Started

DBT (Data Build Tool) transforms raw data in the bronze layer into analytics-ready dimensional models in the gold layer. This guide covers DBT installation, project setup, and your first transformation.

DBT Project Setup Steps

Step 1: Environment Setup

# Install DBT Core
pip install dbt-core

# Install ClickHouse adapter (for our data warehouse)
pip install dbt-clickhouse

# Verify installation
dbt --version

Step 2: Create New DBT Project

# Create new DBT project
dbt init adventureworks_analytics

# Navigate to project directory
cd adventureworks_analytics

Step 3: Configure Database Connection

Update profiles.yml file (usually located in ~/.dbt/profiles.yml):

Step 4: Project Configuration

Update dbt_project.yml:

Step 5: Define Data Sources

Create models/staging/sources.yml:

Step 6: Create Your First Model

Create models/staging/stg_sales_orders.sql:

Step 7: Run DBT Pipeline

Next Steps

Continue to DBT Modeling Guide to build dimensional models.

Last updated