← All resources Article

The model is guessing at raw tables

Text to SQL on a warehouse returns confident numbers that nobody can verify. Here is why it happens, what a semantic layer changes, and what it still does not fix.

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:

What it does not fix

A semantic layer has three limits.

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

  1. Collect twenty real questions from Slack threads and dashboard requests. Not hypothetical ones.
  2. Define the metrics those questions need, starting with the ones where teams disagree. Spend, revenue and ROAS are usually first.
  3. Point the agent at the definitions, not the tables, and log every question that falls outside them.
  4. 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.

See it on your own warehouse.

We will map your models to definitions and show where the gaps are.

Book a demo

Keep reading

Article10 min read

Semantic, vector and graph: what each layer is for

Each layer answers a kind of question the other two cannot. Where each one earns its place, what it is bad at, and the order to build them in.

Read article
Blog5 min read

Every question leaves a record

Query history, intents, answer gaps and flagged questions. How the governance loop in memosight works, and why it sits inside memosight instead of beside it.

Read post