learning-it by example

Back to the video

Star Schema from Scratch: Facts, Dimensions and Grain

Nine order lines, one fact table, three reports, and every report adds up to 64.

Video #256 ยท Data modelling

Steps in the video

  1. 0:00 Nine order lines, one fact table, three reports that each add up to 64.
  2. 0:35 The idea
  3. 1:08 Setup
  4. 1:33 Dimensions, grain and the fact table
  5. 2:17 Loading the dimensions
  6. 2:45 Loading the facts
  7. 3:03 Three reports, one pattern
  8. 3:28 Checking the grain
  9. 3:45 Run the build
  10. 4:32 What this does not show
  11. 5:11 Mistakes to avoid
  12. 5:44 My take and next steps
  13. 6:10 Recap

Files

  • reports.py (15 lines)
  • run.py (28 lines)
  • source.py (23 lines)
  • star.py (65 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

Nine made-up order lines in SQLite; it does not measure speed or cover slowly changing dimensions.

Sources

Learning IT by Example.