What a semantic layer actually is
Define the three building blocks — models, dimensions, and metrics — that turn raw tables into governed business concepts.
A semantic layer sits between your raw database and everyone who asks questions of it. It translates messy physical tables into clean business concepts, and it owns the one true definition of each. Ask it for "revenue by channel" and it knows exactly which tables to join, which rows to exclude, and how to aggregate — every time, identically.
Three building blocks
- Models — your physical tables (orders, customers, products…) and how they join to each other. This is the map the layer uses to connect data.
- Dimensions — the attributes you slice by: date, product category, channel, region, customer segment. The "group by" side of every question.
- Metrics — the numbers you measure: revenue, orders, AOV, CAC, MRR. Each is a governed calculation with exactly one definition.
Every business question is really a request for metrics, sliced by dimensions, optionally filtered: "revenue (metric) by channel (dimension) for the EMEA region (filter)." A semantic layer takes that structured request and produces correct SQL. You never hand-write the SQL again.
What this buys you
- Consistency — revenue means the same thing in every report, dashboard, and AI answer.
- Governance — change a definition once and it updates everywhere; sensitive logic lives in one reviewed file.
- Safety — nobody (no human, no LLM) writes arbitrary SQL against production; they request named, vetted metrics.
- A perfect interface for AI — an LLM is great at mapping natural language to names ("they want revenue by channel") and terrible-and-dangerous at writing correct SQL. The semantic layer plays to that strength.
Real semantic layers exist as products (dbt's MetricFlow, Cube, LookML). In this course you'll run, dissect, verify, and extend a small, transparent one so you understand every moving part — the same concepts scale directly to those tools.
Hold onto this mental model: raw tables in, business concepts out. The learner's job in Part 1 is to define those concepts precisely enough that a machine can compile them.