Data Engineering · Module 05
Data modeling for analytics
- Lessons
- 12
- Free
- 0
- Reading
- ~3 h
Your progress
0 / 12 lessons done
Sign in to trackLessons
- Why data modeling matters for analyticsEvery analytics team reaches the meeting where two dashboards show two revenue numbers. The fix is rarely better SQL; it is deciding which tables everyone reads and what each row in them means.
- Normalized vs denormalized tablesEvery analytical table starts from an app’s normalized tables and decides which joins to do ahead of time. Copy the wrong column and a rename quietly splits a report; refuse to copy anything and every analyst rewrites the same four joins.
- Dimensional modeling: facts and dimensionsMost warehouses, dbt projects and dashboard tools expect data laid out as facts and dimensions. Where each column goes decides whether a new question is one query or a new pipeline step, and whether the totals people read are right.
- Star and snowflake schemasEvery report, dashboard and ad hoc query joins the fact table to its dimensions. The shape of those dimensions decides how many joins each query needs, how many places rows can silently disappear, and how easily analysts write correct SQL.
- Grain: deciding what one row meansEvery fact table starts with a promise about what one row is. When a column breaks that promise, sums double, averages drift and categories steal each other’s revenue, with no error anywhere. Data engineers make this choice on every new table, and it is the hardest one to change later.
- Slowly changing dimensions: types 1, 2 and 3Customers move, products change category and labels get renamed. Every dimension a data engineer builds needs a rule for what happens to past reports when that happens, and the wrong rule changes last month’s numbers with no error anywhere.
- Wide tables: when one big table worksMany readers of analytical data can’t or won’t write joins: a reporting tool’s explore screen, a spreadsheet export, a training-data pull. A wide table built from the star serves them, and a data engineer has to know what it costs to keep correct and when it stops being worth it.
- Data vault: modeling for constant changeSome teams adopt a data vault because it promises full history and easy new sources, then find their analysts lost in joins. Knowing what it buys and what it costs lets you pick it when many changing sources and audits demand it, and skip it when one database feeds a star schema well.
- Modeling events and clickstreamsClick events are the biggest table most data teams own, and the one every product question touches. How you shape them decides whether a funnel takes one cheap query or a scan of billions of JSON rows, and whether two teams’ numbers agree.
- Metrics and semantic layers: one definition eachA clean data model gives every row one meaning, but “revenue” and “average order value” are formulas over rows, and formulas get copied into every dashboard. Data engineers are the ones asked to make those formulas agree, in every tool, after every change.
- Modeling data for machine learning featuresML teams train on the same orders and customers your reports use, but they need every value as it stood on a past date. A table laid out for dashboards quietly hands a model the future, and the model looks good until it meets real customers.
- Design: a data model for an online storeEach modeling technique is easy to get right on its own. Real models break where the techniques meet: a dimension that keeps history, joined by a load written before it did. Designing the whole model at once, with one key rule and checks between the tables, is what keeps a dozen tables telling one story.
Practise with
No tools or paper guides for this module yet.
Terms this module teaches 45
Open glossaryAccumulating snapshot fact table
A fact table with one row per process instance, updated as the process reaches each step.
Additive measure
A measure that gives a correct total when summed along any dimension, including time.
Allocation
Splitting an amount recorded at a coarse grain across finer rows by a stated rule, so the finer rows still add up.
Atomic grain
The most detailed level at which a business process records data; summaries can be built from it, but not the reverse.
Bus matrix
A grid of a data model with one row per business process and one column per dimension, marking which processes use which dimensions.
Business process
In dimensional modeling, an activity the business performs that leaves a record, such as taking an order; each one gets its own fact table.
Clickstream
The sequence of events a visitor’s app or browser records while using a product: page views, searches, taps and similar actions.
Conformed dimension
A dimension shared by several fact tables, with the same keys and attribute values, so their answers can be lined up.
Data mart
Tables built for one group of readers, usually facts and dimensions, read by reports instead of the layers beneath them.
Data model
The set of tables that describe a business for analysis, each with a stated meaning for one row, its keys and the business rules already applied.
Data vault
A way of modeling a warehouse that stores business keys, relationships and descriptive details in separate insert-only tables, with the load time and source on every row.
Denormalization
Storing the same value in more than one row, usually by joining tables ahead of time, so reads need fewer joins.
Dimension table
A table with one row per thing, such as a customer, product or day, holding the descriptive columns reports filter and group by.
Dimensional modeling
Laying out analytical data as fact tables of measured events and dimension tables that describe the things in those events.
Drill across
Combining two fact tables by querying each one separately, grouped to the same dimension attributes, then merging the answers.
Fact table
A table with one row per measured business event, holding the event’s numbers and a key for each thing involved.
Factless fact table
A fact table whose rows record that dimensions came together in an event, with no numeric measure; you measure it by counting rows.
Hash join
A join that loads one side, usually the smaller, into an in-memory hash table on the join key, then looks up each row of the other side in it.
Hashdiff
A hash of a row’s descriptive columns, compared with the stored one to tell whether anything changed.
Hub
A data vault table with one row per business key ever seen, plus when it was first loaded and from which source.
Link
A data vault table with one row per relationship seen between two or more hubs.
Macro (SQL)
A named, stored piece of SQL that queries call like a function, so a shared expression is written once.
Measure
A number recorded in a fact table for each event, which reports sum, count or average.
Mini-dimension
A small separate dimension that holds a group of fast-changing attributes, with its own key on the fact, so the main dimension doesn’t need a new version for every change.
Non-additive measure
A number that can’t be summed across rows to get a correct total, such as a distinct count or a ratio.
Not-applicable member
A dimension row for facts that have no such thing at all, kept apart from the unknown member so that missing matches still stand out.
One big table (OBT)
A wide table that copies the fact table’s rows and every column readers use from its dimensions, so queries need no joins. Built from a star, one per grain.
Outrigger dimension
A secondary dimension table that another dimension references, a limited form of snowflaking used sparingly.
Periodic snapshot fact table
A fact table with one row per thing per fixed period, recording its state or totals at the end of the period, even when nothing happened.
Ratio metric
A metric defined as one metric divided by another, with each part aggregated for the requested grouping before the division.
Record source
A column naming the system or file a row was loaded from, kept so any number can be traced back.
Satellite
A data vault table holding the descriptive details of one hub or link, with a new row each time they change.
Semi-additive measure
A measure that can be summed across some dimensions but not across others, usually not across time.
Slowly changing dimension
A dimension whose descriptive values change now and then, together with the rule that decides what past facts show after a change.
Snowflake schema
A star schema whose dimensions are split into several normalized tables linked by keys, so some details are several joins from the fact.
Spine
The list of entity keys and timestamps a training set is built for, one per row; every feature and the label are joined onto it.
Star schema
A layout with a fact table in the middle and one flat table per dimension, each one join away from the fact.
Surrogate key
A key the data model assigns to each dimension row, separate from any id the source systems use.
Transaction fact table
A fact table with one row per event, written once when the event happens.
Type 1 change (overwrite)
Handling a change in a dimension by overwriting the old value, so every past fact shows the new one.
Type 2 change (new row)
Handling a change in a dimension by adding a new row for the new version, with its own surrogate key and validity dates, and leaving the old row unchanged.
Type 3 change (prior column)
Handling a change in a dimension by moving the old value into a separate prior column and overwriting the main one, so reports can group by either.
Unknown member
A dimension row kept for facts whose real match is missing, so those facts still join and count.
Update anomaly
Two copies of the same fact disagreeing because a change reached one copy and not the other.
Wide table
A table that copies dimension columns onto each fact row, so readers can query it without joins.