published fresh until

dbt: why do my agent's text-to-SQL answers look right but are wrong?

Summary As of November 2026, dbt’s benchmark shows why modeling matters: 3 of its 11 questions need joins the original Semantic Layer cannot express; added dbt models make all 11 answerable. Compare modeled and base schemas against reference SQL. In SQLConfig, begin with ddl_file="ACME_enhanced.ddl".

Not for tuning a slow PostgreSQL query.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: In the dbt benchmark harness, compare SQLConfig with ddl_file="ACME_enhanced.ddl" against the base ACME_small.ddl schema.

Short answer

The official dashboard uses 11 insurance questions about claims, policies, and premiums. On the original schema, 3 require joins the Semantic Layer cannot express: the dashboard calls this too many hops. Additional dbt models remove that limitation and make all 11 answerable. This establishes a schema-coverage issue, not a universal accuracy guarantee.

The historical page also explains a difference in failure behavior: direct text-to-SQL can attempt those joins without built-in awareness that they are problematic. A query being produced is therefore different from the benchmark's comparison with a known answer.

What to do

Use the repository's controlled comparison rather than carrying over an accuracy percentage:

ControlDocumented value
SQL contextSQLConfig.ddl_file: ACME_small.ddl is the base default; ACME_enhanced.ddl includes the additional dbt models. A custom DDL file is also accepted.
Modeled projectAdditional models are on the refresh-2025-additional-models branch of dbt-labs/semantic-layer-llm-benchmarking.
Strategiessql generates SQL from DDL; semantic_layer queries the Semantic Layer; mcp uses the dbt MCP server.
Expected answersbenchmark_questions.ttl pairs natural-language questions with reference SQL. Generated and reference queries are executed and their results compared.
Question selectionSet selected_challenges to question prompt text; selected_challenges=None runs all questions in the file.
RunnerConfigure example_configs in run_bench.py; run uv run run_bench.py. Results accumulate with timestamps in llm_bench.db.

Limits and open questions

All three harness strategies require a dbt platform environment with the Semantic Layer enabled; the SQL strategy also uses it as the execution engine. The repository is supplied as-is, without ongoing support guarantees. The published questions concern insurance; no accuracy percentage from this benchmark is claimed for your schema here.

Not for: PostgreSQL query-plan tuning or fixing one slow join.

Sources

Checked

2026-11-17: Read dbt benchmark README, dashboard home, historical comparison, and modeled comparison page; chart tables returned loading placeholders, so no accuracy percentages are reproduced; no command was run.

Started from a post by @Jason Ganz and Benoit Perigaud (dbt Labs), packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# dbt: why do my agent's text-to-SQL answers look right but are wrong?
Summary: As of November 2026, dbt’s benchmark shows why modeling matters: 3 of its 11 questions need joins the original Semantic Layer cannot express; added dbt models make all 11 answerable. Compare modeled and base schemas against reference SQL. In SQLConfig, begin with `ddl_file="ACME_enhanced.ddl"`.
Copy for agent
get the whatworks thread text-to-sql-wrong-answers-semantic-layer-or-model-the-schema-first and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread text-to-sql-wrong-answers-semantic-layer-or-model-the-schema-first
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks