Skip to content

mgamzec/dbt-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example dbt Project

This is an example dbt project prepared by Pipeline To Insights for tutorial purposes. Check out full blog post for more details.

🔗 Full Post

Overview

This dbt project transforms raw e-commerce data into clean, analytics-ready tables by following a layered approach:

  • Staging Layer → Standardises raw data
  • Intermediate Layer → Aggregates and processes data
  • Marts Layer → Provides final business-ready tables

Project Structure

ecommerce_project/
│-- models/
│   ├── staging/      
│   │   ├── stg_orders.sql
│   │   ├── stg_customers.sql
│   │   ├── stg_payments.sql
│   │   ├── sources.yml
│   │   └── schema.yml
│   ├── intermediate/   
│   │   ├── int_order_summary.sql
│   │   ├── int_payment_summary.sql
│   │   └── schema.yml
│   ├── marts/         
│   │   ├── mart_customer_lifetime_value.sql
│   │   ├── mart_orders_payments.sql
│   │   └── schema.yml
│   ├── data/
│   │   ├── orders.csv
│   │   ├── customers.csv
│   │   ├── payments.csv
│   ├── analyses/  
│   ├── macros/  
│   ├── seeds/  
│   ├── snapshots/ 
│   ├── tests/ 
│-- .gitignore 
│-- dbt_project.yml
│-- profiles.yml
│-- README.md

Installation & Setup

  1. Install dbt:
pip install dbt-core dbt-postgres
  1. Configure profiles.yml(update database credentials):
ecommerce_project:
  target: dev
  outputs:
    dev:
      type: postgres
      host: localhost
      user: my_user
      password: my_password
      port: 5432
      dbname: my_db
      schema: public
  1. Test the connection:
dbt debug
  1. Run the models:
dbt run
  1. Run the tests:
dbt test
  1. Generate and serve documentation:
dbt docs generate
dbt docs serve

About

This is an example dbt project prepared by Pipeline To Insights for tutorial purposes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published