1:05:02

Andy Elseth builds a dimensional data model for sales data using DuckDB and the Kimball methodology. He covers data cleansing, surrogate keys with MD5 hashes, slowly changing dimensions, and compares star and snowflake schemas, showing the star schema runs faster queries.

Questions this video answers

DuckDB is a lightweight, in‑process SQL engine that can be accessed via Python (or other languages). It lets you spin up a full SQL database on a single machine without installing a server, making it ideal for rapid prototyping and for doing transformations entirely in SQL rather than switching to Pandas. If you later need to scale out beyond a single node, you can move to a distributed engine.

Hashing creates a deterministic, near‑unique string from one or more input fields. Using MD5 as a surrogate key gives you a repeatable identifier that doesn’t rely on the source system’s natural key. It’s useful for dimensions where the business key may change, but it has downsides: possible collisions (rare for typical dimension sizes) and larger storage than integer keys. For fact tables, integer or date keys are often better for partitioning and indexing.

You can enforce FOREIGN KEY constraints to ensure referential integrity, UNIQUE constraints to prevent duplicate values, and custom CHECK constraints for domain rules (e.g., ZIP code format). It’s also best practice to validate data before loading—run tests, raise alerts, and clean data upstream to avoid runtime failures.

CSV is common for bulk loads, but many sources provide JSON (or XML) via APIs. DuckDB (and most modern databases) can parse JSON files; you just need different syntax to extract fields. Because JSON can be semi‑structured, you should test for missing keys and handle schema evolution.

Chapters

More from Richie

youtube.com

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

5mo ago
youtube.com

17.8% of the World Now Uses AI — And the Gap Is Widening | The Median #5

5mo ago
youtube.com

Create GPTs to Automate Go-To-Market Research

5mo ago
youtube.com

What Happened to Self-Driving Cars? #AI

5mo ago
youtube.com

Never Use AI For This #warning #AI #flights

5mo ago
youtube.com

Use AI Agents to Analyze Power Grid Optimization

5mo ago
youtube.com

This is how modern AI actually solves problems #AITrends #AI

5mo ago
youtube.com

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

5mo ago
youtube.com

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

5mo ago
youtube.com

Build an AI‑driven Dashboard

5mo ago
youtube.com

What’s Broken in Labor Markets Today #datascience

5mo ago
See all content