Skip to main content
πŸ‘€ Written & Reviewed by Bill Gao (Lead Editor) β€’ Jul 26, 2026 β€’ ai-data

sqlsure Review 2026: Catch Silently-Wrong AI-Generated SQL

sqlsure is a deterministic SQL semantic inspector that flags double-counting, bad joins, and exposed PII in AI-written queries before they run. We review how it works as a CI gate, MCP server, and library.

A query can be perfectly valid, run without error, and return a number that’s silently wrong β€” revenue double-counted by a join, an average summed, a patient ID exposed. Databases don’t catch it, linters don’t catch it, and an LLM reviewing its own SQL doesn’t catch it. sqlsure does.

What is sqlsure?

sqlsure is a deterministic SQL semantic inspector. You point it at a query and a β€œrulebook” of facts your team already declared (dbt tests, PK/FK relationships, or a live DB introspection), and it flags semantic errors in about 0.1 ms β€” before the query runs. It’s built for AI-written SQL in particular, where silently-wrong output is common.

Key features

  • Deterministic checks β€” catches fan-out double-counting, wrong joins, and exposed PII.
  • Three doors β€” a CI gate (exit 1 on violations), an MCP server for agents, and an embeddable library.
  • Reuses what you have β€” dbt tests become grain, relationships become join cardinality, one-line tags mark what’s safe to sum.
  • Self-repairing agents β€” every rejection carries a machine-actionable fix, so an agent can loop draft β†’ check β†’ fix β†’ check β†’ execute.
  • Private by default β€” offline, no data access, no telemetry; it parses query text only.
  • Audited β€” over BIRD + Spider gold answers: 2,568 queries, 45 flags, zero false alarms.

Who should use it?

sqlsure is for anyone shipping AI-written SQL β€” text-to-SQL products, agent pipelines, or just Claude Code generating reports. Drop it in CI or as an MCP gate so wrong queries never execute. It pairs naturally with dbt-based stacks.

It’s focused on correctness, not performance tuning, and it needs you to declare semantics (even loosely via introspection) before it can judge.

Pros and cons

Pros: catches the bugs linters miss, deterministic and offline, agent self-repair, zero false alarms in its benchmark audit.

Cons: requires declaring semantics; centered on correctness rather than performance; early rulebook (v0.1).

Pricing

Free and open source β€” install via pip install sqlsure (Apache-2.0).

FAQ

Does sqlsure connect to my database? No. It parses query text only and never accesses data; introspection reads schema metadata (PK/FK), not row data.

Can my agent fix queries automatically? Yes. Each rejection includes a machine-actionable fix; in their benchmark, applying the fix verbatim produced a passing query 10/10 times.

How is it different from a linter? Linters catch syntax and style; sqlsure checks semantics β€” whether the query computes the right thing given your declared grain and relationships.

✍️
Bill Gao Lead Editor

Founder and lead editor at 9bests. Oversees software evaluations, documented taxonomy models, and qualitative editorial ratings. Read our full editorial methodology.

Explore the best AI Data tools

Related Articles

Subscribe to the 9bests weekly β€” get the full list free

Hand-picked AI tool reviews and updates every week. Subscribe to receive this full list + 7 more quick-reference sheets (writing / image / video / audio / chat models / data / API cost).

Subscribe free & get it β†’

Independent reviews β€” ratings aren't influenced by vendor payments Β· double opt-in Β· unsubscribe anytime