What Is Text-to-SQL?
Text-to-SQL (also called natural language to SQL, NL2SQL, or text2sql) is a technology that converts a plain-language question into an executable SQL query. Instead of writing a SELECT statement by hand, a user describes the data they want in everyday language and an AI model translates it into SQL. The combination of large language models and schema-aware parsing has made this practical for day-to-day use.
It matters because SQL is the gate to most enterprise data, and most people cannot write it. Text-to-SQL removes that barrier: a business user asks "what was revenue by region last quarter?" and gets an answer in seconds, without filing a ticket to the data team. It is the engine behind conversational analytics and many AI data agents.
Text-to-SQL turns a natural-language question into a SQL query using an LLM plus schema-aware parsing. It makes data accessible to non-technical users and turns analysis from days into seconds. The catch is accuracy: frontier models score around 85 percent on clean academic benchmarks but collapse on real enterprise schemas, where even the best models reach only about 20 percent on Spider 2.0's enterprise-scale databases. Add a semantic layer and explicit business context and enterprise accuracy climbs back to roughly 85 to 95 percent. The hard part is never the SQL syntax; it is knowing which table is authoritative, what a metric means, and what a user is allowed to see. Dawiso supplies that governed context, the business glossary, catalog, lineage, and classification, so text-to-SQL resolves to the right, trustworthy query.
What Text-to-SQL Means
Text-to-SQL sits between a person (or an agent) and a database. The user expresses intent in natural language; the system produces SQL that, when executed, returns the requested data. Modern systems are powered by generative AI and increasingly by agentic workflows that plan, generate, validate, and sometimes self-correct a query rather than emitting it in a single shot. The goal is the same throughout: let people query data in the language they already speak.
How It Works
A typical text-to-SQL flow has a few stages:
- Understand the question. The model interprets the natural-language request and the user's intent.
- Read the schema. It is given the database structure, table and column names, types, and relationships, so it can map concepts to real fields. Tools that connect directly to your database generate more accurate queries because they work with your real names rather than guessing.
- Generate SQL. The model produces a SQL query matching the intent and schema.
- Validate and execute. Stronger systems check the query for syntax and safety before running it, then return the result, sometimes feeding it back to refine the answer.
Benefits
Text-to-SQL addresses three long-standing problems in enterprise data access. Accessibility: it removes the technical barrier that keeps business users from querying data directly. Speed: self-service turns analysis from days or weeks into seconds. Consistency of syntax: a good system produces syntactically valid queries every time, avoiding the slips that happen when people hand-write SQL. Together these let far more people get answers from data without waiting on a small team of analysts.
Why Accuracy Depends on Context
The decisive factor in text-to-SQL is not the model's ability to write SQL, it is how much context it has about your data. The accuracy gap between benchmarks and reality is stark. On clean academic benchmarks like the original Spider, frontier LLMs reach roughly 85 to 90 percent. On Spider 2.0, which uses enterprise-scale schemas, the same frontier models drop to only about 20 percent, a collapse often called the enterprise cliff. Add a governed semantic layer and explicit business context, with metrics precisely defined, dimensions mapped, and synonyms registered, and enterprise accuracy rises to roughly 85 to 95 percent in real deployments. The reason is simple: the model can write flawless SQL against the wrong table, or compute a metric with the wrong definition, and still return a confident, plausible, wrong number. Context is what closes that gap.
Challenges
Relying on a single model call against a raw database surfaces predictable failure modes. Complex queries, multi-table joins and questions that span several time periods, are hard to parse correctly. Completeness and correctness of results are not guaranteed, especially when a term is ambiguous or a metric is defined differently across teams. And without syntax validation and access checks, generated queries can fail, or worse, return data a user should never have seen. These are the same enterprise failure modes explored in depth in why text-to-SQL breaks in the enterprise. Warehouse-native tools such as Databricks AI/BI Genie and Snowflake semantic views improve accuracy precisely by adding semantic context inside their platform.
How Dawiso Fits
Text-to-SQL is only as good as the context behind it, and that context is exactly what Dawiso governs. The model already knows SQL; what it lacks on a real enterprise warehouse is the business meaning, authority, and sensitivity of the data. Dawiso supplies all three:
- Business meaning. The business glossary defines what each term and metric means, so "revenue" or "active customer" resolves to the agreed definition instead of the model's guess.
- The authoritative source. The data catalog and lineage identify which table is the trusted source and where its data came from, so the query hits the right one.
- Sensitivity and access. Classification marks sensitive fields, so a generated query does not surface data a user should not see.
- Served to any agent via MCP. The Context Layer delivers this governed context to any MCP-compatible text-to-SQL tool or agent through the MCP Server.
The same governed context also powers a consistent metrics layer, so the number text-to-SQL returns matches the rest of the business. Give the model your governed context, and text-to-SQL moves from a demo trick to something the enterprise can trust.
Conclusion
Text-to-SQL converts plain-language questions into SQL with an LLM and schema-aware parsing, making data accessible and fast for everyone. Its weakness is not syntax but context: accuracy swings from 50 to 95 percent depending on whether the model knows which table is authoritative, what a metric means, and what a user may see. Governed business context is what closes that gap. Pair text-to-SQL with a governed glossary, catalog, lineage, and classification, and natural-language questions return answers you can trust.
See it in action
Business Glossary
Clear context is essential to ensure everyone interprets terms consistently and accurately.