Data Governance · 4 min read

When Agents Write SQL, a $24 Million Gap Hides in Your Metadata

A $24 million gap between two answers to one question illustrates why semantic layers, not dashboards, now decide what AI-agent users trust, and what data teams must define.

By Tom Whitfield716 words

Key takeaways

  1. Same question, same warehouse: $412M vs $388M, a $24M gap from reinvested-dividend treatment
  2. Zach Mandell (dbt Labs), dbt Summit 2026: 92.3% free-throw shooter makes 10 straight only ~45% of the time
  3. 65bp fee with 10bp waiver on $2B assets: forgetting the waiver overstates revenue by $2M a year
  4. Recommended start: 10 board-level metrics, each with description, owner, and 5 test questions
  5. Summing AUM across 90 days invents money; flows are additive, balances are not
When Agents Write SQL, a $24 Million Gap Hides in Your Metadata
Pexels / pixabay

One question produced two answers: $412 million and $388 million, a $24 million gap from the same warehouse. The difference was definitional. One query counted reinvested dividends as inflows; the other did not. The piece making this argument, published on HackerNoon under the title "The Semantic Layer Is the New User Interface," contends the semantic layer (the governed metric definitions between the warehouse and the user) has become the product users actually experience.

Why did the two answers diverge?

A dashboard hides definitional drift because one analyst froze a choice behind a chart years ago. An AI agent re-picks the definition on every question, the author writes. If the choice is not written where the model can read it, the model guesses. Nobody hallucinated in the example; the rules were simply unwritten.

The prescription is four jobs for data engineering teams, illustrated with fund data.

Job one: capture unwritten knowledge

Every warehouse runs on rules that live in people's heads, the author argues: flows dated by trade date rather than settlement date, share class conversions excluded. An analyst with 6 years on the desk knows the exceptions; the agent knows none. The fix is closer to interviewing than engineering. Teams should sit with the people who answer these questions, commit the answers as code, and capture edge cases such as mid-year fund mergers.

The illustrative metric spec includes a description, synonyms ("net sales", "net new money", "net inflows"), an owner, a filter excluding transaction types REINVEST and CONVERSION, and a time dimension of trade_date, all versioned at v3.

What must the metadata carry?

Four fields matter most, and none is new; the reader is.

  • Synonyms. Users say "net sales" and mean the same metric. If the synonym is absent, the agent searches raw tables.
  • Additivity. Flows sum across days. AUM (assets under management) does not, because it is a balance. Summing it across 90 days invents money.
  • Grain and join paths. Joining a fund-level measure to holdings makes a fund with 300 positions appear to hold 300 times its assets.
  • Freshness and restatement. Finance data gets restated, so "last quarter" needs both as-reported and as-restated dates.

A missing description once annoyed the next engineer, the author notes. Today it hands a VP the wrong answer.

How does governance get enforced?

A policy document does not stop a bad number, the author writes. A failing build does. The recommended controls: an owner and version on every metric; plain-English test questions with known answers run in CI on every change; scheduled reconciliation to a system of record; scoped access so the agent sees only what the user is entitled to; and labels on answers that fell back to raw SQL.

At dbt Summit 2026, Zach Mandell of dbt Labs offered the arithmetic: a 92.3 percent free-throw shooter makes 10 in a row only about 45 percent of the time. An agent that must find table, column, join, and filter runs that chain every question. A governed metric turns 4 guesses into 1 lookup. The figure is a probability analogy, not a measured agent benchmark, and the article offers no field data on accuracy gains.

Which definitions break?

The article lists four terms that finance and sales or product teams use differently: AUM, net flows, revenue, and return. The revenue example is concrete. A fund billed at 65 basis points with a 10 basis point waiver earns 55. Forget the waiver on $2 billion of assets and revenue is overstated by $2 million a year.

What should a team do this week?

The author's starting point: pick the 10 metrics that reach the board, write the plain-language description before the SQL, name an owner, and add 5 test questions per metric. Then run one experiment: ask the agent the same question from two different accounts and compare the numbers. Matching answers mean the semantic layer works; divergent ones mark the first metric to fix.

Two caveats the author concedes. The layer covers only what is defined, so exploratory questions still fall back to raw SQL, and a wrong definition is now wrong everywhere. An agent can draft descriptions from query logs, but someone accountable must still decide what "revenue" means and sign it. No platform purchase is required.

Google News: Data Engineering (Source)

Price tags

Share this article:

More from Tom Whitfield

Tom Whitfield

Show full bio

Staff writer covering regulation, policy and their impact on Analytics Digest is a professional daily at Analytics Digest.

78 articles

Read also

« Previous article