Expert analysis

Talking to company data – why text-to-SQL returns answers that look right and are wrong

The „ask your data a question” demonstration is impressive on a clean schema with twenty columns and falls apart on a warehouse holding a thousand. The problem is not syntax – the model writes valid SQL. The problem is that this valid SQL computes something other than what the person meant, and the answer gives no sign of it. This article shows where the silent errors come from, what a semantic layer fixes, and how to check answer quality before they reach the board.

Author: Kacper Włodarczyk, Founder of ALGORCOMPPublished: August 23, 2026Reading time: 13 min readData and analyticsFor: Mid-sized company
Talking to company data – why text-to-SQL returns answers that look right and are wrong

Why the demo works and the deployment does not

The gap between a demonstration and production has hard support in the benchmarks. On Spider 1.0 – an academic set with readable schemas – agents reach around 91%. The same agent on Spider 2.0, a set built from real enterprise workflows, drops to 21,3%. That is not a difference in model quality; it is a difference in what the schema looks like.

A real warehouse in a mid-sized company holds hundreds of tables, columns named with abbreviations from the nineties, technical columns beside business ones, fields populated differently depending on who entered the record, and several generations of solutions nobody removed because „something still uses it”. The model receives all of it at once and has to guess which field corresponds to the concept the person is asking about.

Then there is the join problem. „How much did we sell last quarter to premium-segment customers” takes one join in a well-modelled warehouse. In a warehouse that grew organically it takes six – and every one of them is a place to lose or duplicate rows. The dbt benchmark showed this directly: some questions were out of reach for one approach precisely because they required too many hops between tables.

The conclusion is inconvenient for tool vendors but simple for planning: the effectiveness of conversational analytics in your company depends mainly on the state of your data model, not on which engine you choose.

  • Spider 1.0 – 91,2%, Spider 2.0 on real workflows – 21,3% for the same agent
  • a real schema: hundreds of tables, abbreviated names, several generations of solutions
  • join complexity causes errors more often than question complexity
  • the state of the data model decides the outcome, not the choice of engine

Anatomy of a silent error

According to Omni's analysis, 81,2% of text-to-SQL errors arise at the schema or semantic level rather than in syntax. The distinction matters operationally: a syntax error ends in a message you cannot miss. A semantic error ends in a number.

The most common example: „what was our revenue in June”. A warehouse often holds three answers – the net value of invoices issued in June, the value of orders fulfilled in June, and the value recognized in the accounts in June. Each is correct from some department's perspective and each yields a different figure. The model picks the first field that looks right and reports the result without qualification.

The second family of errors concerns filters nobody states out loud because they are obvious to people inside the company: that cancelled documents do not count, that the subsidiary is reported separately, that corrections belong to the month of the original invoice. Those rules live in four people's heads and in the code of a few reports, but not in the schema – so the model will not apply them.

The third family is units and currencies. A price column with no indication of whether it is net or gross, in what currency, converted at what rate, is simply a number to the model. The answer will contain a total that looks exactly as it should – and will be wrong.

  • a syntax error ends in a message, a semantic error ends in a number
  • „revenue” can be computed three correct ways yielding different results
  • rules obvious to people (cancellations, corrections, subsidiaries) do not exist in the schema
  • units and currencies without description are the quietest kind of error
Talking to company data – why text-to-SQL returns answers that look right and are wrong

What a semantic layer fixes

A semantic layer is a set of definitions sitting between the database and the person asking: a list of metrics with an unambiguous calculation, the dimensions they may be sliced by, the relationships between entities, and descriptions in the language the company actually speaks. The model then does not write a query from scratch – it selects from a closed set of concepts.

The effect shows in the numbers. In the dbt Labs benchmark from 2026, grounding in a semantic layer raised accuracy from 90,0% to 98,2% for Claude Sonnet 4.6 and from 84,1% to 100% for GPT-5.3-Codex. It is worth knowing the scale of that measurement: eleven questions run twenty times each on a single insurance dataset. That is a strong directional signal, not proof of universal effectiveness – which is precisely why it is worth measuring the same thing on your own data.

A far more interesting result comes from the same study. Before data models were added, both approaches performed moderately: 64,5% for text-to-SQL and 72,7% for the semantic layer. Adding just three models lifted both sharply. That is the strongest argument in the whole discussion: the work that genuinely improves answer quality is data modelling, not tool selection.

A semantic layer has one more benefit rarely mentioned in an AI context: it forces definitional disputes to be settled. To build one, somebody has to decide what revenue is. That is often the hardest part of the project and simultaneously the part that pays off whether or not anyone ever asks the model a question.

  • a semantic layer = unambiguous definitions of metrics, dimensions and relationships
  • the model selects from a closed set of concepts instead of writing a query from scratch
  • the largest quality gain comes from data modelling, not from changing the language model
  • a valuable side effect: definitional disputes finally get settled
Answer accuracy in the dbt Labs 2026 benchmark (insurance dataset, 11 questions × 20 runs)
VariantText-to-SQLSemantic layer
Raw schema, no data models64,5%72,7%
After adding 3 data models – Claude Sonnet 4.690,0%98,2%
After adding 3 data models – GPT-5.3-Codex84,1%100%

How this plays out in Power BI

In the Microsoft ecosystem you do not have to build a semantic layer from scratch – it is already there and it is called the semantic model. Measures defined in DAX are exactly what definitions of metrics are in other stacks: one binding way to compute revenue, margin or turnover.

The difference between a company where Copilot in Power BI works well and one where it answers nonsense usually comes down to three things. First: whether figures are computed by measures or ad hoc inside visuals. Second: whether tables, columns and measures have their descriptions filled in, and whether those descriptions are written in business language rather than database shorthand. Third: whether the model contains synonyms – the fact that sales says „turnover” and the board says „sales” has to be recorded somewhere.

The practical order of work therefore looks different from what most projects assume. First a review of the semantic model and completion of descriptions for the area you want to start with – usually sales or finance. Then a list of twenty questions people actually ask. Only then do you switch the assistant on. The reverse order ends in the conclusion „Copilot does not work”, when what does not work is the model description.

It is also worth narrowing the starting scope. An assistant over one well-described area answers credibly; the same assistant over every model in the organization has a dozen similarly named tables to choose from and starts guessing.

  • the Power BI semantic model is a ready-made semantic layer – it needs describing
  • DAX measures instead of ad hoc calculations inside visuals
  • table, column and measure descriptions in business language, plus synonyms
  • start from one area and twenty real questions, not from switching the assistant on
Analyst comparing query results against metric definitions on a dashboard

The model does not refuse to answer an ambiguous question. It picks one definition and states the result with full confidence – and the person who asked has no way to notice a choice was made.

How to test before you let the board in

Conversational analytics needs the same rigour as any other AI component in production: a set of questions with expected answers, run regularly after every change.

The set is built from history, not from imagination. Take twenty to fifty questions that reached analysts by email or chat over the last quarter and establish the correct answer for each – the one the area owner will sign off on. That is simultaneously a quality test and a list of definitions to complete in the model.

Measure two things separately. First: whether the number is right. Second, and more important: whether an ambiguous question prompted a clarifying question instead of a guess. An assistant that responds to a revenue question with „do you mean invoiced value or fulfilled orders” is worth more than an assistant with a higher raw score that never signals doubt.

Repeat the test after every change to the data model and every change of engine version. It is the same mechanism we describe under AI agent evaluation – and in analytics it matters especially, because a change in the semantic model can alter answers to questions seemingly unrelated to it.

  • 20–50 real questions with answers approved by the area owner
  • measure number correctness and behaviour on ambiguous questions separately
  • asking for clarification instead of guessing is a desirable trait, not a flaw
  • re-run the test after every data model change and engine version change

Related topics in the knowledge base

Related materials on data and analytics

FAQ

Frequently asked questions about conversational analytics

The questions that come up most often in „talk to your data” projects at mid-sized companies.

Will a newer language model solve this without work on the data?
No. Published benchmarks show that moving from a clean academic schema to a real enterprise one cuts the same agent's accuracy several times over, and that the largest quality gain comes from adding data models rather than changing the language model. A newer model raises the ceiling but does not replace metric definitions.
Does that mean text-to-SQL is useless?
No – it has sensible uses. It works for ad hoc analysis on smaller, well-understood datasets when an analyst who can judge the result is at the keyboard. The problem starts when the answer goes straight to someone with no way to verify where the number came from.
How much work is preparing a semantic model for one area?
For a sales area in a mid-sized company, typically 2–6 weeks, with most of the time going not to technology but to agreeing definitions across departments. If you already have a working Power BI model with measures, the starting point is much closer – what is usually missing is descriptions and synonyms.
Will an assistant over data replace reports?
It will complement them. A report answers repeatable, planned questions; an assistant answers one-off and unforeseen ones. In practice, a well-designed assistant reduces the volume of „please pull me a one-off extract” requests and frees analyst time for work that requires interpretation.

About this page

About the author

Kacper Włodarczyk

Założyciel ALGORCOMP

Założyciel ALGORCOMP. Specjalizuje się we wdrożeniach Microsoft 365 Copilot, Copilot Studio, Power Platform (Power Automate, Power Apps, SharePoint) oraz agentów AI dla średnich firm B2B w Polsce. Prowadzi dziesiątki projektów z zakresu strategii AI, governance Power Platform, automatyzacji obiegu dokumentów i procesów sprzedażowych. W publikacjach koncentruje się na praktycznych aspektach wdrożeń AI w organizacjach — od pierwszego POC do skalowania na całą firmę, ze szczególnym uwzględnieniem bezpieczeństwa danych, zgodności (RODO, NIS2, AI Act) i zwrotu z inwestycji.

Meet the team

Want your board to query the data directly?

Free 30-minute consultation: we review the state of your data model, pick a starting area, and draw up the list of questions worth measuring answer quality against. You leave with a realistic assessment of how much work stands between you and trustworthy conversational analytics.

Featured

Related articles