DBT Modeling Guide
Dimensional Model for Sale Processes
Overview
Fact Table
Dim Date
Dim Territory
Dim Product
Star Schema Design
@startuml
!theme plain
entity fact_sale {
* sale_key : bigint <<PK>>
--
* date_key : int <<FK>>
* territory_key : int <<FK>>
* product_key : int <<FK>>
--
order_qty : decimal
unit_price : decimal
line_total : decimal
sub_total : decimal
tax_amt : decimal
total_due : decimal
sales_order_id : int
}
entity dim_date {
* date_key : int <<PK>>
--
date : date
year : int
quarter : int
month : int
day : int
day_of_week : int
week_of_year : int
is_weekend : boolean
fiscal_year : int
fiscal_quarter : int
}
entity dim_territory {
* territory_key : int <<PK>>
--
territory_id : int
territory_name : varchar(50)
country_region_code : varchar(3)
territory_group : varchar(50)
region_name : varchar(50)
}
entity dim_product {
* product_key : int <<PK>>
--
product_id : int
product_name : varchar(50)
product_number : varchar(25)
product_category : varchar(50)
product_subcategory : varchar(50)
standard_cost : decimal
list_price : decimal
is_current : boolean
}
dim_date ||--o{ fact_sale
dim_territory ||--o{ fact_sale
dim_product ||--o{ fact_sale
@endumlBuilding Dimensional Models
Fact Table Creation
Dimension Tables
Testing and Documentation
Data Quality Tests
Macros and Utilities
Next Steps
Last updated