Skip to content
Reviewed by Siddharth Sharma Oct 07, 2026

Home › Guides › Text-to-SQL

Tech Explained · 2026

What Is Text-to-SQL in 2026? How It Works, Why the Semantic Layer Decides Accuracy and 6 Steps to Ship One

Text to SQL turns a plain-English question into a query your warehouse runs, then hands back rows as an answer. Model choice barely moves accuracy. The semantic layer does: Snowflake reports Cortex Analyst going from 51% on bare tables to over 90% through a curated semantic model.

7 October 202611 min readBy the 360 Digital Transformation Editorial Team
Key takeaways
  • The model is not the bottleneck. Frontier models write competent SQL already. What they cannot guess is whether your company counts a cancelled order as revenue.
  • The semantic layer is the accuracy lever. Snowflake's documented jump from 51% to over 90% came from a YAML semantic view, not a bigger model.
  • Leaderboards are shakier than they look. A 2026 analysis flagged annotation error rates of 52.8% in BIRD and 66.1% in Spider 2.0-Snow.
  • Scope is a hard constraint. Microsoft Learn advises 25 tables or fewer per source for a Fabric data agent, across at most five sources; Databricks caps a Genie Space at 30 tables.
  • Always ship the SQL with the answer. A number without its query is an unauditable number, and finance finds out eventually.

A VP types "revenue by region last quarter" into a chat box, gets a number four seconds later, and pastes it into a board deck. Nobody notices the generated query hit orders_raw instead of fct_orders, so cancelled orders are still in there and the South region looks better than it is. That is the real risk profile of text to sql in 2026: not loud failure, but confident success on the wrong table.

What Is Text-to-SQL, and What Actually Happens Between the Question and the Rows

Text to SQL is a pipeline, not a prompt. Six things happen between a typed question and a returned table, and five of them are engineering decisions you control.

The text-to-SQL pipeline, end to end

Steps 2, 3 and 5 are where accuracy is won or lost. Step 4 is the part everyone obsesses over.

Text-to-SQL request pipeline A business question flows through context retrieval and schema linking, then SQL generation, a validation gate and warehouse execution, returning an answer with its SQL. Approved queries feed back into a verified query library that supplies examples to context retrieval. 1. Business question plain English, no SQL 2. Context retrieval semantic model, glossary 3. Schema linking pick tables and columns Verified query library approved SQL feeds step 2 4. SQL generation model writes candidate SQL 5. Validation gate dry run, limits, access 6. Answer and SQL shown side by side asks top-k schema SQL rows logs examples

Pipeline shape drawn from vendor documentation and published text-to-SQL research, checked 7 October 2026.

Why schema linking is the real bottleneck

Schema linking decides which tables and columns the model is even allowed to consider, and the research is blunt about why it breaks. In business intelligence settings tables carry so many columns that feeding the whole schema into the prompt hits token limits, and ambiguous column names are far more common than in toy databases. The Spider 2.0 benchmark was built to reflect that, with databases averaging around 800 columns each. Published work also tends to assume users name columns and values exactly as the database spells them. Nobody types cust_sgmt_cd = 'PRM'. They type "premium customers".

Natural Language to SQL and Text-to-SQL: Any Difference?

None that matters. Natural language to sql is the older academic phrasing, text-to-SQL is what the benchmarks and vendor docs use, and "data agent" or "GenBI" is the 2026 product name for the same pipeline with a chat interface and a feedback loop attached. If a tool claims it is "not just text-to-SQL", check whether it adds a governed semantic layer or only a nicer chat window.

Why Text-to-SQL Accuracy Collapses Without a Semantic Layer

One finding should reshape how you budget this work. Snowflake's published position on Cortex Analyst is that routing questions through a semantic model took it to over 90% SQL accuracy on an internal 150-question benchmark, against 51% for single-shot GPT-4o on the bare tables. Databricks reports the same shape for AI/BI Genie, citing 32% to over 90% against a leading coding agent in an internal May 2026 benchmark. Both are vendor-run tests on their own data, so treat the exact figures as directional. The pattern is what to trust: the same class of model roughly doubles its hit rate once a human has encoded what the data means.

Three numbers that frame the whole problem

The gap between a demo and production is a semantic artefact, not a model upgrade.

51% to 90%+
Vendor-reported accuracy for one text-to-SQL product, bare tables versus a curated semantic model
67-70%
Execution accuracy reported for the strongest proprietary models on Spider 2.0-Snow, an enterprise-scale benchmark
~800
Average columns per database in Spider 2.0, which is why schema linking decides everything

Figures from vendor documentation and published benchmark results, checked 7 October 2026. Vendor benchmarks are self-reported.

A semantic layer is a contract, not a cache. It states that "revenue" means sum(net_amount) from fct_orders where status is not cancelled, that claims join to policies through policy_sk and never policy_number, and that "premium customers" maps to one segment code. Snowflake does this with YAML semantic views, Databricks pulls definitions from Unity Catalog and caps a Genie Space at 30 tables, and Microsoft lets a Fabric data agent sit on a Power BI semantic model alongside lakehouses and warehouses. Different syntax, identical idea. If you have never built a dimensional model with certified metrics, that is the gap to close first, and it is the backbone of the DP-700 syllabus worked through in class on 360DT's live Microsoft Fabric data engineering programme. Also read: Microsoft Fabric vs Databricks in 2026.

Text-to-SQL vs a Semantic Layer vs a Classic Dashboard

These are not competitors. They are three points on a curve from "answers anything badly" to "answers one thing perfectly", and most teams need two of the three.

Criterion Raw text-to-SQL on tables Text-to-SQL via semantic layer Classic BI dashboard
Who writes the query The model, unsupervised The model, inside a contract An analyst, once
Setup before first useful answer An afternoon Two to six weeks of modelling Days per dashboard
Accuracy on ambiguous business terms Poor, roughly coin-flip in vendor tests Vendor-reported above 90% Exact, by definition
Handles a question nobody anticipated Yes, with risk Yes, within modelled scope No
Row-level security and governance Whatever the connection grants Inherited from the model and catalog Enforced in the report
What breaks on a schema change Silently wrong answers Model validation fails loudly The visual breaks loudly
Auditability of a number Only if you log the SQL Metric definition is the audit trail Full, the logic is in the file
Best for Exploration on a sandbox Ad-hoc questions on governed data The 20 numbers the business reads weekly

My read: build dashboards for the numbers the business already reads weekly, then put a semantic-layer-backed agent in front of the long tail. Skipping straight to the agent because dashboards feel old fashioned is the most expensive mistake available here, because you end up modelling under deadline pressure while an executive asks why the chat gave two different revenue figures.

The Tools: Microsoft Fabric Data Agent, Cortex Analyst vs Genie, and the Open-Source Route

Your platform usually picks your tool for you. What differs is where the semantics live and what the hard limits are, and the limits are the part the sales deck skips.

  Microsoft Fabric data agent Snowflake Cortex Analyst Databricks AI/BI Genie Open-source stack
Where semantics live Power BI semantic model, lakehouse, warehouse, KQL DB or ontology YAML semantic views mapping terms to facts, dimensions and metrics Unity Catalog definitions plus manual tuning in the Genie Space Your own vector store of DDL, docs and example queries
Documented limits Up to 5 data sources; Microsoft Learn advises 25 tables or fewer per source Scoped to the semantic view you publish Genie Spaces capped at 30 tables Whatever you enforce yourself
Entry cost Paid Fabric capacity F2 or higher, or Power BI Premium P1 or higher with Fabric enabled Snowflake credits on your existing account Databricks DBUs on your existing workspace Infrastructure plus LLM API spend
Vendor-reported accuracy Not published as a single figure Over 90% on an internal 150-question benchmark 32% to over 90% in an internal May 2026 benchmark Depends entirely on your example library
Response ceiling Preview runtime returns a summary plus up to 1,000 rows, raised from 25 Tabular result from the generated query Tabular result plus generated visuals Your call
Best fit Teams already on Power BI and OneLake Snowflake-centric warehouses with disciplined metric governance Lakehouse teams with Unity Catalog already in order Data residency constraints, or a strong platform team
Watch out for Capacity cost is a floor you pay whether or not anyone asks a question Semantic view maintenance becomes a standing job The 30-table cap forces hard scoping decisions early Project churn: the main Vanna repository was archived read-only on 29 March 2026

On the open-source side the category has moved. Vanna popularised storing DDL, documentation and example SQL in a local vector store and retrieving them per question, and that pattern is now the default everywhere; the project is MIT-licensed with self-hosted options, but its main repository went read-only in March 2026. Picking an open stack today means choosing between successors such as Wren AI, pitched as a governed GenBI platform, and MindsDB, which pairs text-to-SQL with federation across a very large number of sources. Build retrieval and validation yourself and you can swap the front end later.

Retrieval mechanics matter more than people expect. Production systems layer BM25 keyword matching on top of embedding similarity and fuse the rankings, because "DAU" and "daily active users" must find the same metric. That is RAG, pointed at a schema instead of a document corpus, and 360DT's AI Engineer course builds that hybrid retrieval and tool-calling pattern live. For the vendor-neutral theory first, read Retrieval Augmented Generation Explained.

What This Actually Costs, and Where the Build Time Goes

Keep one running example in mind for the rest of this guide: a two-person data team at a mid-size general insurer in Pune, about 40 tables in a Fabric warehouse, eleven business users who currently WhatsApp the lead analyst for numbers. This is an illustrative scenario, not a client of ours, but the shape is common.

Cost splits in two. The platform floor comes first: consuming a Fabric data agent requires a paid capacity of F2 or higher, or Power BI Premium P1 or higher with Fabric enabled, and F2 is listed around USD 262.80 a month pay as you go or about USD 156.33 a month on a one-year reservation. You pay that whether or not anyone asks a question. Per-call consumption is small next to it, reported in the region of 10 to 18 capacity-unit-seconds for the data agent API. Some Power BI Copilot scenarios practically land at F64, listed near USD 5,250 a month, which is the point where viewer Pro licences stop being needed. For eleven users, reserved F2 is the sane starting point, and anyone quoting F64 here is selling a licence model rather than a solution.

The bigger cost is engineering time, and it is not distributed the way project plans assume.

Where your build time actually goes

Spend 40% of the effort on definitions and only 10% on the model, or you will spend the next quarter debugging answers.

Semantic model and metric definitions40%
Verified question and SQL example library20%
Evaluation set and regression runs15%
Validation gate and access guardrails15%
Prompting and model selection10%

Recommended allocation for a first production build, not a measured industry statistic. Reflects the vendor and research evidence cited above, reviewed 7 October 2026.

For the Pune team, 40 tables already exceeds the 25-per-source guidance, so the first real decision is not technical. It is picking the 20 tables that answer most of the eleven users' questions, then telling the rest no for a quarter. That conversation is the project.

Is Text-to-SQL Worth It in 2026? The Honest Caveat

Be more sceptical of the published numbers than the vendors are. A 2026 analysis of the two benchmarks everyone cites found annotation error rates of 52.8% in BIRD and 66.1% in Spider 2.0-Snow, meaning a majority of items in those reference sets were flagged as having labelling problems, which the researchers concluded undermines the leaderboard rankings themselves.

The number that should slow you down

A leaderboard score is a research signal, not a production guarantee.

52.8%

Share of items in the BIRD text-to-SQL benchmark flagged as containing annotation errors in a 2026 analysis, with 66.1% reported for Spider 2.0-Snow.

From peer-reviewed benchmark analysis published in 2026, checked 7 October 2026.

So who should not bother? If your data lives in six spreadsheets and one Tally export, a text-to-SQL agent is theatre: there is no schema to link against, and the capacity costs more than an analyst's afternoon. If your metric definitions are genuinely contested, meaning sales and finance disagree about what a closed deal is, the agent will automate the argument rather than settle it. Fix the definition first. And if nobody can own the semantic model after launch, do not launch. An unmaintained semantic model decays faster than a dashboard, because nothing visibly breaks when it goes stale.

What usually goes wrong here
  • The agent gets a read-only role with too much reach. Someone grants it the whole warehouse because scoping is annoying, and three weeks later it cheerfully aggregates the salary table. Scope the role, not the prompt.
  • Dates eat your accuracy budget. "Last quarter" means the fiscal quarter, and in India that very likely starts in April. Encode the fiscal calendar as a dimension or you will ship wrong numbers that look right.
  • Nobody writes the eval set, so nobody can tell if a change helped. You tweak the prompt, two answers get better, one silently regresses, and you find out in a review meeting.
  • The SQL is hidden to make the UI feel magical. Then an analyst spends two hours reverse-engineering a figure, and ambiguous questions get answered confidently instead of questioned back.

How to Ship a Text-to-SQL Agent in 6 Steps

1. Write the evaluation set before you write anything else

Collect 30 real questions from the people who will use it and have your best analyst hand-write the correct SQL for each. Store the question, the gold SQL and the expected row count. That file is your definition of done, your regression suite and your answer when someone asks for more scope. Without it you tune blind. The same discipline applies to any LLM feature, which LLM Evaluation in 2026 covers in depth.

2. Build the semantic model, and be ruthless about scope

Certified metrics, explicit join paths, a fiscal calendar dimension, and synonyms for every term people actually say. Cap it at 20 to 25 tables per source, as Microsoft Learn advises for a Fabric data agent. This is dimensional modelling, the core of the DP-700 syllabus taught live in 360DT's Microsoft Fabric Data Engineer course.

3. Seed a verified query library

Index the 30 gold queries from step one, plus every query your team already trusts, alongside the DDL and column descriptions. Use hybrid retrieval so "DAU" and "daily active users" hit the same metric. This library is the highest-return asset in the system, and it grows for free if step six is built properly.

4. Put a validation gate in front of execution

Before generated SQL touches the warehouse: enforce a read-only role, reject anything containing DDL or DML, inject a row limit, run an EXPLAIN dry run and reject queries whose estimated scan crosses a threshold you set, and confirm row-level security applies as the asking user and not the service principal. That last one is the compliance landmine. Inside Microsoft 365, those agent-permission controls are AB-900 territory, covered in 360DT's Microsoft 365 Copilot and Agent Administrator course.

5. Return the answer and the SQL together, always

Two panes: the rows, and the query that produced them, with the metric definitions named. Add a one-line statement of assumptions, for example "fiscal quarter Jul to Sep 2026, cancelled policies excluded". This one choice turns the agent from a liability into a training tool, because analysts learn the model by reading its queries. Also read: SQL Query Optimization in 2026 to judge whether generated SQL is efficient.

6. Close the loop with a human approval step

A thumbs up promotes a query into the verified library; a thumbs down files it as a failing eval case. Run the full eval set weekly and on every model or prompt change, and watch accuracy per question category rather than one average, because an average hides the fact that every date-range question broke. Instrumenting that is standard agent operations work, covered live in 360DT's MLOps Engineer course.

Which Skills to Learn if You Want Text-to-SQL Work on Your CV

The uncomfortable truth for analysts is also the opportunity. If your value is the hundredth variant of a filtered aggregate, that work is genuinely compressing. If your value is knowing the claims table double-counts reopened claims, it just became the scarcest thing in the building, because that is precisely what the semantic layer encodes and what no model can infer.

Four skills carry the weight. Dimensional modelling and metric governance, which is DP-700 and Fabric territory. SQL fluent enough to reject a generated query at a glance, where the SQL and Power BI work in 360DT's Data Analyst course starts, with PL-300 attached. Retrieval engineering: embeddings, hybrid search and tool calling, taught live in the AI Engineer programme. And evaluation discipline, so you can prove a change helped. The certifications overview maps the exam paths against each other, and a free webinar tests whether the Fabric side suits you more cheaply than a voucher does. For developers, the validation gate and tool-calling layer is application engineering: a text-to-SQL agent is a tool-use loop with a strict schema, which is what the CCDV-F developer prep course drills.

Live course

Text-to-SQL is only as good as your semantic model. Learn to build one properly.

Live online·Sat–Sun, 8–11 PM IST·50+ hrs·Rs 24,999

Microsoft Fabric data engineering for the DP-700 certification, with DP-900 fundamentals included, over 8 live weekend weeks. Hands-on projects, mentor support and placement guidance.

Explore the course
Microsoft Fabric Data Engineer Course (DP-700 + DP-900 + Claude)

What I Would Do in Your Position

If you are the lead analyst at that Pune insurer, I would not start with the agent. Spend six weeks on a certified semantic model over the 20 tables that answer most questions, ship three dashboards for the weekly numbers, and only then switch on a data agent scoped to exactly that model, with the SQL visible and the 30-question eval set running every Monday. The agent becomes the long-tail interface, not the primary one. You trade a slower launch and a narrower scope for answers you can defend in an audit, and I would make that trade every time.

If you are trying to get hired into this work rather than deploy it, the odds tilt heavily toward the modelling skill, because thousands of people can prompt a chatbot and very few can define a grain-correct fact table and defend it. That is the thing to go and learn, and the Microsoft Fabric Data Engineer course is where we teach it live, weekend by weekend, with DP-700 at the end.

Frequently asked questions

What is text to sql in simple terms?

Text to SQL takes a question in ordinary language, works out which tables and columns answer it, writes a SQL query, runs it and returns the rows. In 2026 the serious implementations add a semantic layer in front, which tells the model what your business terms mean before it writes anything.

Is text-to-SQL accurate enough to trust in 2026?

Trustworthy within a scope you have modelled, unreliable outside it. Vendors report over 90% accuracy when questions route through a curated semantic model, against roughly half that on bare tables. On the hardest enterprise-scale public benchmark, Spider 2.0-Snow, the strongest proprietary models land around 67 to 70% execution accuracy, so treat it as a fast draft that a human can verify, not an unsupervised oracle.

Do I need Microsoft Fabric to build a data agent?

No. Fabric is the convenient route if your organisation already runs Power BI and OneLake, because a Fabric data agent can sit directly on an existing semantic model. Snowflake Cortex Analyst and Databricks AI/BI Genie do the equivalent job on their platforms, and an open-source stack works if you are willing to own retrieval, validation and the example library yourself.

How much does a Microsoft Fabric data agent cost to run?

Consumption requires a paid Fabric capacity of F2 or higher, or Power BI Premium P1 or higher with Fabric enabled. F2 is listed around USD 262.80 a month pay as you go and about USD 156.33 a month on a one-year reservation, and that floor applies whether or not anyone asks a question. Per-call consumption is modest, reported around 10 to 18 capacity-unit-seconds for the data agent API. Pricing changes often, so check the current Microsoft pricing page before budgeting.

What is the difference between natural language to SQL and a semantic layer?

They sit at different points in the same pipeline. Natural language to SQL is the translation step that produces a query. The semantic layer is the governed set of definitions, certified metrics, join paths and access rules that the translation step reads from. One generates, the other constrains, and the evidence says the constraining half is what determines whether the output is correct.

Can I build a text-to-SQL agent on an open-source stack?

Yes, and it is a reasonable choice when data residency rules keep everything on your own infrastructure. Expect to build hybrid retrieval over DDL, documentation and verified example queries, plus your own validation gate. Note that project churn is real in this category: the main Vanna repository, which popularised the RAG-based approach, was archived read-only on 29 March 2026, so evaluate successor projects on maintenance activity, not just features.

About this guide. 360 Digital Transformation is an Anthropic Partner and a Microsoft Authorized Training Partner. Other certification bodies, vendors and employers named here are not affiliated with us. Product features and pricing change often; figures cited were checked on 7 October 2026.

Learn it live with 360 Digital Transformation

Turn this guide into a skill employers can see

Live weekend cohortEMI available

Microsoft Fabric Data Engineer Course (DP-700 + DP-900 + Claude)

Rs. 24,999Rs. 31,249 Save 20%

Tools and platforms you work with

  • Microsoft Fabric
  • Apache Spark and PySpark
  • Delta Lake
  • T-SQL
  • Python
  • Fabric Notebooks
  • Git
  • GitHub
Add bonus modules
See the syllabus and batch dates

Other live courses on this career path