Final Project
8.3 Part 2: Build the Fact Table
Scenario
Now that you have clean silver data and dimension tables, you need to create the fact table - the heart of your star schema. This table will store all the complaint events with foreign keys to your dimensions, enabling fast analytical queries.
Exercise Requirements
Create a fact table that:
Stores: All complaint events with metrics
Links: To dimension tables via hash keys
Enables: Fast aggregation and filtering for analytics
Maintains: Historical data with proper SCD handling
Step 1: Create SQL Data Loader Block
Click "Blocks" → "Transformer" → SQL: Base template (generic)”
Name the block:
build_fact_nyc311Connect it to the following blocks blocks:
build_dim_agencybuild_dim_complaint_typebuild_dim_locationtransform_to_silver_layer
Step 2: Implement the Fact Table SQL
Step 3: Run and Validate
Click "Execute with all upstream blocks"
Verify the entire pipeline runs successfully
Validate your star schema:
Step 4: Orchestrate the analytics pipeline
Navigate to the
mage_academy_nyc_311pipeline you createdAdd a new block downstream from the data exporter block
Click "Blocks" → "Exporter" → “Orchestration” → “Trigger Mage pipeline”
Add the code below:
Learning Objectives
After completing the fact table exercise, you should understand:
✅ Fact table design in a star schema
✅ Storing metrics and measures in fact tables
✅ Using foreign keys to link dimensions
✅ Implementing incremental fact table loads
✅ Building analytical queries across the star schema
✅ Orchestrating a pipeline run from another pipeline
