Axisdream
Written and Published byAxisdream·

Valid SQL, Wrong Answer

A query reaching a database through a layer of defined business terms

Key Takeaways

  • •A model can write syntactically correct SQL against the wrong definition of revenue. A semantic layer is what supplies the definition before the query runs.
  • •Examines where text-to-sql breaks, analyzing the structural bottlenecks and trade-offs in real-world deployments.
  • •Provides engineering benchmarks and verification criteria for what a semantic layer provides.

NVIDIA's Auto Ontology became a prominent GitHub project during the first week of November 2026. It describes an open framework for semantic, graph-based reasoning over enterprise data, exposed through MCP, a command line and an API.

The problem it addresses is easy to state and hard to fix. A database schema tells a model which tables exist. It does not tell the model what the business means by an active customer, which of three revenue columns is authoritative, or whether two similarly named fields measure the same thing.

Where text-to-SQL breaks

A schema is a description of storage. Column names, types, foreign keys and indexes describe how data is arranged, not what it represents.

Ask a model for last quarter's revenue and it has to choose. There is a total amount column, a recognised amount column and a net amount column. One excludes tax, one defers across the contract term, one subtracts refunds. All three are revenue in some context and only one answers the question that was asked.

The model picks one. It builds a query that runs, returns a number and is wrong, and nothing in the process flags the error because every mechanical step succeeded.

That failure is not a modelling deficiency that a larger model resolves. A bigger model is better at inferring intent from context, and the ambiguity is in the data model rather than the language. No amount of capability recovers a definition that exists only in the head of the finance team.

What a semantic layer provides

A semantic layer is a definitional layer between the data and the query. It maps physical columns to business concepts, records which aggregation applies, and states which source is authoritative when several could serve.

An ontology goes further by describing the concepts and their relationships in a form a machine can reason over. A customer has orders, an order has a recognised revenue event, a revenue event belongs to a period. Those relations let a system infer that a question about quarterly performance concerns recognised revenue rather than invoiced amount.

A knowledge graph is the instantiation: the concepts plus the actual entities and their links. The three terms are often used interchangeably and they describe different artefacts, which matters because a system can have a good ontology and a stale graph.

A business glossary is the human-readable version. The BIRD benchmark exists because text-to-SQL accuracy depends on how well a system understands the schema it queries. It is the artefact that lets a controller confirm that the definition the system uses is the definition the business intends.

The workflow the project describes

Auto Ontology derives context from existing metadata, connects to semantic models that already exist, reconciles definitions that conflict, and validates generated queries against certified definitions and lineage.

Each of those steps addresses a distinct failure.

Deriving context from metadata means reading table comments, view definitions, dbt models and BI tool configuration to recover definitions that were written down somewhere but not in the database.

Connecting to existing semantic models matters because enterprises rarely start from nothing. A dbt project or a LookML model may already hold the definitions, and duplicating them creates a second source of truth that will drift.

Reconciling conflicts is the hard step. Two departments will have definitions of active that disagree, and a system has to either resolve them or surface the disagreement to a human rather than picking silently.

Validating against lineage closes the loop. If a query is built from a certified metric, its result inherits that certification. If it touches an uncertified column, the system can say so before the number reaches a dashboard.

Why lineage is the part practitioners undervalue

A number without provenance is an assertion. The question a finance team asks about an unexpected figure is where it came from, and the answer needs to trace through the aggregations to the source rows.

Lineage provides that trace. It also provides the mechanism for impact analysis, which is what changes when a definition is revised. A team that alters the recognised revenue definition needs to know which dashboards, reports and models depend on it, and lineage answers that question mechanically.

Without lineage, a semantic layer is a dictionary with no authority. It states what a term means and cannot show which queries used the term correctly.

Where the approach struggles

Four issues, and the project's own documentation is careful about them.

Stale metadata is the most common failure. A definition changes in the source system and the semantic layer keeps serving the old one, which is worse than having no layer because the answer now carries false authority.

Conflicting definitions resist automation. Two teams can both be right within their own scope, and a system that resolves the conflict by preference rather than by domain will be wrong for one of them.

Coverage is never complete. A semantic layer covers the metrics someone bothered to define, and the long tail of ad hoc columns is where most queries actually land.

And product claims are not proof. A framework that can reconcile every enterprise's definitions in principle may require more curation than a given organisation will sustain, and curation cost is the reason semantic layers have failed before.

The governance question underneath

A semantic layer is a claim about who decides what a number means.

If the layer is owned by a data team, the definitions reflect that team's understanding. If it is owned by finance, engineering queries inherit finance's conventions. Either way, the authority structure is a governance decision that precedes the technology.

That is why the durable implementations are organisational rather than technical. A certified metric works because someone with authority certified it and someone else accepted the certification, and the software only carries the result.

What to build first

The smallest useful version is a single domain with a handful of contested metrics. Pick the three definitions that cause the most arguments, write them down with an owner's name attached, and wire them into the query path so that a request for the term resolves to the certified definition rather than the model's guess.

That produces something a finance team can check and a safety net for the queries that matter most. Broad coverage is a later problem, and it is the one that usually kills the project, because the long tail is long and the curation budget is finite.

An agent that queries enterprise data needs the definitions more than it needs a bigger context window. The retrieval problem is solved by putting the right definition in front of the model, and the definition is a governance artefact rather than a technical one.

Related Dispatches