How Miro Took Text-to-SQL Accuracy From Under 40% to Over 90%
“Analytics accuracy is not a code generation problem. LLMs are good already at writing SQL. The problem is context and routing. You give them enough business context, and you give them the table they should use, and they can write the SQL properly.”
- Challenge: With more than 20,000 datasets across Snowflake, dbt, and Looker and no metadata layer between the agent and the warehouse, Miro's natural language query tool was returning wrong answers and losing users.
- Solution: Miro deployed DataHub as the context layer in a hybrid architecture, using Claude Code to orchestrate question decomposition and DataHub MCP to surface governed metadata, with Snowflake Cortex executing the final SQL.
- Impact: Text-to-SQL accuracy rose from below 40% to over 90%, measured against a benchmark of 900 real business questions, with a deterministic data product mode delivering consistent results for analysts who need them.
The Challenge
What happens when an LLM knows the SQL but not the data?
Miro is an online collaboration platform where teams connect tools, canvases, and workflows in a shared visual workspace. Its data estate reflects that breadth: more than 20,000 datasets spread across Snowflake, dbt, and Looker, spanning domains from finance to marketing to product analytics.
When Miro connected Claude Code directly to Snowflake to enable natural language querying for business users, the early results were promising for simple questions. Then the wrong tables crept in. A question as fundamental as “give me the active users” would return something plausible built on the wrong join or the wrong filter. Ronald Angel, Lead Product Manager at Miro, and his team measured this precisely. Using an evaluation bank of 900 questions created manually by data experts across business domains, they benchmarked accuracy at less than 40%.
“People start just quietly leaving the tool,” Ronald observed.

The failure mode was gradual abandonment of the tool due to a lack of trust. The team identified the root cause clearly. The LLM was not the problem. The pipeline could generate fluent SQL. The problem was that it lacked context to route to the right table in the first place. It had no way to distinguish a raw staging table from a production semantic view, or to know which of 20,000 datasets actually answered the business question at hand. Without a context layer, business semantics and routing were guesswork.
The Solution
How Miro built a context layer that agents can actually navigate
The fix was architectural before it was technical. Rather than continuing to connect Claude Code directly to Snowflake with no context layer, Miro placed DataHub between the orchestrator and the SQL engine, using the DataHub MCP server to expose data entity descriptions, tags, glossary terms, column schemas, lineage, and search to the agent. With that foundation in place, Miro worked through four steps to push accuracy from below 40% to over 90%.
01 | DataHub as the context layer
The first move was to give the agent a metadata layer to work with. Miro does not use dbt Cloud, which meant dbt model documentation had no native home the agent could reach. DataHub became that home. DataHub ingested the dbt model metadata and enriched it with entity descriptions, tags, glossary terms, column definitions, lineage relationships, and example queries already governed in DataHub. Exposed through the DataHub MCP server, that combined context gave the agent pipeline what a direct Snowflake connection never could: an understanding of what each model represented, not just what it contained.
The DataHub MCP integration gave the agent pipeline five specific capabilities it lacked with a direct Snowflake connection:

With that layer in place, the agent could finally understand what models represented and not just what they contained. Accuracy rose from below 40% to ~65%.
Better, but the agent was still routing to the wrong table in more than 30% of cases.
02 | Question decomposition and parallel search
Business questions rarely resolve to a single entity. A question like “how many active users do we have?” spans multiple facts and dimensions that need to be resolved together before the right table comes into focus. The team built a decomposition layer that splits each natural language question into its constituent facts and dimensions, calls DataHub in parallel for each concept, and combines the results before generating SQL. That parallel resolution is what catches the routing failures a sequential search misses.

03 | A metadata signal framework
Usage frequency is a good baseline signal. But at 20,000+ datasets spanning raw tables, staging models, and production semantic views, Miro needed a ranking that reflected trust, not just popularity.
When we started analyzing why zombie evals were failing, one of the most common reasons was because it was getting the information from the raw table that was not ready.
Ronald AngelLead Product Manager, Miro
The team built a boosting framework around five metadata signals that surfaced the right candidate, not just the most-used one:
- Schema ranking: tables closer to semantic views and data products ranked above raw tables
- Looker lineage: models with downstream lineage connections to Looker received a higher trust signal, since most Miro metrics surface there
- Usage quality gate: only tables with more than five active users and sufficient documentation quality were returned, filtering out stale or abandoned assets
- Data product membership: models published inside a Miro data product and exposed through a semantic view were marked as the highest-trust candidates
- Decomposed joins: facts and dimensions resolved separately, then joined, ensuring both sides of a complex query pointed at the right table
This framework pushed accuracy from ~65% to ~85%.
04 | Documentation quality as the last mile
The remaining gap came down to metadata quality. Reviewing the benchmark questions still failing at 85%, the team found that many failures traced not to routing logic but to sparse model documentation or deprecated columns the agent could not distinguish from live ones.
The fix was targeted and deliberate. Miro curated only the data products critical to its AI use cases, documenting them with business definitions, dimensions, and measures in dbt, loaded into DataHub via MCP. The remaining 20,000+ assets were intentionally left out of scope. The reasoning was direct: when the right asset is well-documented and exposed as the only semantic view the agent can reach, routing errors disappear. The agent does not need to choose between 50 tables. It sees one.
Deprecated columns were tagged explicitly in DataHub so the agent stopped treating them as candidates. Business glossary terms and tags anchored the most critical data products. And key metrics were published through semantic views and data products, making the highest-trust assets unambiguous. With those changes in place, accuracy crossed 90%.
Two modes for two kinds of analyst
One final observation from the deployment: not all analysts want the same thing from a natural language query tool. Some want to explore the full catalog broadly, where accuracy runs between 85% and 90%. Others want deterministic answers and are willing to scope their query to governed data products to get them. For this group, Miro surfaces a mode that restricts results to well-documented data products and semantic views, delivering accuracy consistently above 90%. The agent asks which mode the analyst wants before executing.
Some people want to explore data broadly… Some people can say, I want only data products or semantic views that are well documented, and this gives us a higher than 90% level of accuracy.
Ronald AngelLead Product Manager, Miro
The Impact
Miro’s text-to-SQL tool went from a system that analysts quietly stopped trusting to one that routes business questions to governed answers with over 90% accuracy.

Key outcomes included:
- Below 40% to 90%+ accuracy, measured against 900 real business questions. The evaluation bank covers questions across finance, marketing, product, and other domains, running daily and updated with each model change.
- Wrong-table routing reduced from over 60% of cases to under 10%. The metadata signal framework and question decomposition layer together addressed the routing failures that a direct Snowflake connection could not catch.
- A repeatable four-step playbook. Each step measurably closes the gap that any team can follow from a raw LLM baseline to a governed context layer.
- Business user trust restored. Analysts had quietly stopped using a tool that looked right but wasn’t. The context layer gave them one they could rely on.
- A deterministic path for analysts who need it. Scope to governed data products and semantic views, and the answer is consistent regardless of how the question is phrased.
Miro: before and after DataHub Cloud
| Area | Before DataHub Cloud | With DataHub Cloud |
| LLM context | Claude Code connected directly to Snowflake with no metadata layer; Cortex received raw schema with no business context | DataHub MCP exposes entity descriptions, tags, glossary terms, lineage, and schema to Claude Code for routing and to Cortex for SQL generation |
| Text-to-SQL accuracy | Sub-40% on 900 benchmark questions across business domains | 90%+ in deterministic data product mode |
| Table routing | Wrong table in more than 30% of cases; raw tables selected over production semantic views | DataHub surfaces the most trusted table, not just the most popular one |
| Deprecated columns | Stale columns looked the same as live ones; the agent picked them anyway | Tagged explicitly in DataHub; filtered from agent results |
| Documentation coverage | Sparse across 20,000+ datasets | Critical data products selectively curated by hand: semantic views documented with business definitions, dimensions, and measures for agent consumption; remaining assets intentionally out of scope |
| Analyst experience | Wrong answers that looked right; analysts quietly stopped using the tool | Trusted answers; broad exploration mode (85–90% accuracy) and deterministic data product mode (90%+ accuracy) |
Learn more about DataHub Cloud Context Platform.