Semantic layer
Also: metrics layer, business glossary layer
What is Semantic layer?
A semantic layer is a curated description of your data — business names, metric definitions, joins and allowed filters — that sits between raw tables and whoever, human or model, is asking questions.
What Semantic layer means
A semantic layer maps the raw database (tables like `ord_hdr` and columns like `amt_net_2`) onto business language: "orders", "net revenue", "active customer". It records how metrics are calculated, which joins are valid, which columns are dates, what a fiscal quarter means and which values a status field can hold. Tools such as dbt metrics, Cube or LookML implement it; a well-structured YAML or JSON file can do the same job for a Text-to-SQL system.
For Text-to-SQL it is the single biggest lever on accuracy. Instead of guessing that revenue means `SUM(amount)`, the model is told that net revenue excludes cancelled orders and GST, and is given the exact expression. Ambiguity is resolved once, in a file the data team owns, rather than on every query.
It is not a data warehouse, a dashboard or documentation for its own sake. It is the definition of record. If two dashboards disagree on churn, the semantic layer is where you settle the argument, and the model inherits the settled answer.
Who it really matters to
- Data lead: this is where your team's tribal knowledge about "how we actually calculate that" gets written down and becomes enforceable.
- CTO / Head of Engineering: it decouples analytics AI from schema churn; rename a column and you update one mapping rather than retraining or re-prompting.
- CFO: a single definition of revenue, margin and churn across every report and every AI answer is worth more than any individual chart.
- Product manager: for a customer-facing analytics feature, it is the contract that keeps every tenant's numbers consistent and explainable.
Why it exists
Semantic layers exist because databases are designed for storage, not for questions. Column names are abbreviated, metrics are computed differently in different reports, and the knowledge of which join double-counts lives in one analyst's head. A language model pointed at such a schema will guess, confidently and often wrongly. The trade-off is upfront effort: someone has to write and maintain the definitions, and they will surface disagreements that were previously hidden. That is a feature. The layer pays for itself the first time it stops an AI answer from contradicting the monthly board deck.
Where it is applied
- Defining "active subscriber" once so a SaaS company's dashboards, investor updates and in-app analytics all agree.
- Encoding an NBFC's DPD buckets and NPA rules so a query about "overdue accounts" uses the regulator's definition, not a guess.
- Mapping a retailer's store hierarchy so "South region" resolves to the same set of stores in every question.
- Standardising a university's definition of enrolled, deferred and withdrawn students across finance and academic reporting.
- Giving a logistics firm's model the correct expression for on-time delivery, including the agreed grace window.
Is Semantic layer a skill?
Technique / practiceA data-modelling technique, usually delivered as a versioned configuration file. Eazyware builds one as the first step of every natural language data querying engagement, because accuracy without it is guesswork.
Eazyware service that covers it: Natural Language Data Querying. Starting prices are on the pricing page.
Frequently asked questions
Do we need a semantic layer if we already have dbt or a warehouse?
Probably a lighter one. If metric definitions already exist in dbt or LookML, the model can consume them. What is usually missing is the plain-language description: synonyms, examples and the caveats an analyst would mention out loud.
Who should own the semantic layer?
The data team, with sign-off from finance on money metrics. It should live in version control, be reviewed like code and be tested against the golden question set every time it changes.