Connecting an LLM to a data warehouse takes an afternoon. Ask it "what was ROAS by advertiser last month?" and you get a table back in seconds. The number looks plausible and the query ran without errors, but nothing in the answer tells you whether it is right.
That gap between "the query ran" and "the answer is correct" is where most warehouse AI projects stall. The model is usually fine at SQL. The raw tables just do not carry the meaning it needs.
Three ways it goes wrong
1. Column names are a guess
A typical ads mart has cost_micros from Google, spend from Meta, and amt_usd from a billing feed someone added last year. All three look like spend. The model picks one based on the name and whatever sample rows it sees. Sometimes it picks the right one. You find out which when finance asks why the number does not tie out.
2. Business terms have more than one definition
Revenue means booked revenue to finance, attributed conversion value to marketing, and closed-won amount to sales. ROAS depends on which revenue you divide by, which attribution window applies, and whether returns are netted out. None of that is in the column metadata. The model fills the gap with a reasonable default, and reasonable defaults are how two dashboards end up disagreeing.
3. Nobody can see what it ran
Even when the answer is right, nobody downstream can confirm it. There is no record of which tables were joined, which filter was applied, or who asked. When a number is wrong, nobody can trace it. When it is right, nobody trusts it enough to act on it.
A wrong number that looks right is worse than no number. It gets pasted into a deck.
What a semantic layer changes
A semantic layer moves the meaning out of people's heads and into code. Metrics, dimensions and join paths are defined once, versioned with the dbt project and reviewed like any other model:
metrics:
- name: roas
description: Conversion value divided by spend
type: ratio
numerator: conversion_value_usd
denominator: spend_usd
With that in place, text to SQL stops generating queries against raw tables. The model maps "ROAS by advertiser last month" to the roas metric, the advertiser dimension and a time window, and the semantic layer compiles the SQL. The join path is the approved one, the definition is the one finance signed off on, and the answer can cite both.
Three things improve at once:
- Consistency. The dashboard, the Slack bot and the agent all resolve the same definition, so they return the same number.
- Traceability. Every answer lists the metrics and dimensions it used, which are readable by people who do not write SQL.
- Honest failure. When a question needs a metric that is not defined, the system can say so instead of improvising.
What it does not fix
A semantic layer has three limits.
- It only knows what you modeled. Coverage is the main cost. Expect the first weeks to surface a long list of questions with no definition behind them. That list is useful, but it is work.
- It does not read documents. "What did the client say about the landing page?" has no table. That needs retrieval over tickets and notes.
- It struggles with multi-hop relationships. "Which campaigns lost ROAS and share a creative with a paused campaign?" is awkward as metrics and dimensions. A graph built on an ontology handles it better.
That is why memosight treats the semantic layer as the first of three layers rather than the whole stack. The companion article covers how vector and graph retrieval fill the other two gaps.
Where to start
- Collect twenty real questions from Slack threads and dashboard requests. Not hypothetical ones.
- Define the metrics those questions need, starting with the ones where teams disagree. Spend, revenue and ROAS are usually first.
- Point the agent at the definitions, not the tables, and log every question that falls outside them.
- Review the gaps weekly. Each one is either a new definition to add or a question to route somewhere else.
Aim for a small set of questions that are answered correctly every time, with a visible record of how. Coverage grows from there.