Final Project
8.2 Part 1: Build the Dimension Tables
Scenario
Your analytics team needs to analyze complaints by agency, type, and location. You'll create three dimension tables that provide context and enable efficient filtering and grouping.

Exercise 1A: Agency Dimension
Requirements
Create a dimension table that stores unique agencies responding to 311 complaints.
Step 1: Create SQL transformer block
Click "Blocks" → "Transformer" → "SQL: Base template (generic)”
Name the block:
build_dim_agencyConnect it to the
transform_to_silver_layerblock
Step 2: Implement the Dimension SQL
Step 3: Validate
Run the block
Query the table to verify unique agencies were loaded
Confirm hash keys match those in the silver layer

Exercise 1B: Complaint Type Dimension
Requirements
Create a dimension table for complaint types and their descriptors.
Step 1: Create SQL Data Loader Block
Click "Blocks" → "Transformer" → SQL: Base template (generic)”
Name the block:
build_dim_complaint_typeConnect it to the
transform_to_silver_layerblock
Step 2: Implement the Dimension SQL
Step 3: Validate
Run the block
Query the table to verify unique agencies were loaded
Confirm hash keys match those in the silver layer

Exercise 1C: Location Dimension
Requirements
Create a dimension table for geographic analysis by borough and zip code.
Step 1: Create SQL Data Loader Block
Click "Blocks" → "Transformer" → SQL: Base template (generic)”
Name the block:
build_dim_locationConnect it to the
transform_to_silver_layerblock
Step 2: Implement the Dimension SQL
Step 3: Validate
Run the block
Query the table to verify unique agencies were loaded
Confirm hash keys match those in the silver layer
Learning Objectives
After completing these dimension exercises, you should understand:
✅ Star schema dimensional modeling concepts
✅ Creating dimension tables with hash-based surrogate keys
✅ Handling slowly changing dimensions (Type 1)
✅ Using MERGE for incremental dimension loads
✅ Ensuring referential integrity through consistent key generation
