Skip to content

NL2SQL 0.8.0

Wave B of the redesign: business knowledge (a glossary and other knowledge sources) now reaches the index and the prompts, a review queue holds every proposed change until someone accepts it, a schema profiler proposes joins, roles and drafted descriptions, ambiguous questions can be re-asked with a choice, every answer can say why, and a cost rule can refuse or confirm an expensive query. A few APIs and flags change: read Upgrading before you install it.

Released 2026-10-28.

Highlights

  • Business knowledge. Knowledge sources (the yaml glossary first) are merged, filtered by the caller's scope and shown or exported with engine.knowledge. Descriptions, synonyms, roles, units, joins and rules now go into the index and into the planner's prompt, and a changed glossary marks the index stale. nl2sql index --refresh re-renders the entries from the stored snapshot with no schema read and no model call.
  • A review queue and a profiler. Every proposed change (a profiler finding, a thumbs-up, a correction, a chosen reading) is filed in one queue, and accepting it is the only way anything is written. engine.knowledge.profile() proposes joins and column roles from bounded probes, and with draft=True the profiler model drafts missing descriptions under a cost cap (nl2sql profile --draft --max-cost).
  • Clarifying questions, and why an answer is what it is. A question that can be read more than one way ends as needs_clarification with up to three options, each explained. run_query(choice=) runs the chosen plan, and a pick can be saved as a glossary term proposal. Every successful answer carries an explanation, written from the typed plan, not from model text.
  • A cost guard and corrections. policies.cost is enforced: over the limit, a query is allowed, held for approval or refused as COST_LIMIT_EXCEEDED, using a rows-read estimate from PostgreSQL, MySQL, SQL Server and DuckDB. engine.feedback.correct() checks a fixed plan or SQL and files it as a verified-query proposal.

What's included

Features

  • The shared shapes for knowledge, review, profiler, clarify, explain and cost, and store interface version 3 (#329).
  • Adapters: estimate (rows read) on PostgreSQL, MySQL, SQL Server and DuckDB, and probe_overlap on all five built-ins (#332).
  • explanation on QueryResult: why this answer, rendered from the typed plan (#335).
  • Knowledge sources, merge, scope filter, show and export, and the yaml source with a checked, atomic writer (#336).
  • The review queue: one way to file a proposal, accept as the only writer, and thumbs-up proposals (#337).
  • The clarifier and the needs_clarification result (#339).
  • Knowledge in the planner's prompts, and the terms and rules used on each answer (#340).
  • engine.feedback.correct(): a checked fix filed as a verified-query proposal (#341).
  • The cost rule, enforced by the built-in policy.cost hook (#342).
  • The profiler: join and column-role proposals from bounded probes (#343).
  • The glossary in the index, index --refresh, and no model text written into the index (#344).
  • Clarifications: choice= on run_query and stream_query, save_choice, settled phrases, a prompt in nl2sql run on a terminal, and choice on the MCP ask tool (#345).
  • Drafted descriptions under a cost cap, filed for review (#347).
  • The retrieval inspector shows only what the caller's scope reaches (#348).

Known limits

  • The playground and the REST API trust the caller-supplied role. See the security model.
  • The retrieval inspector over-fetches to apply a caller's scope, so a caller for whom most matches are hidden can see a short list (#348).
  • Business metrics are still deferred. A glossary term with columns is the prose half of a metric.
  • SQLite has no cost estimate, so the cost rule treats its queries as unknown.

Upgrading

pip install --upgrade "nl2sql-engine[demo]==0.8.0"

Third-party store authors: pip install "nl2sql-sdk==0.8.0".

Breaking changes: a few. Each needs a look before you upgrade.

  • nl2sql index --enrich, --curated-only and their enrich= and curated_only= parameters are gone (#344). The index no longer calls the model to write descriptions, and the playground's "write descriptions with the LLM" option is gone. What to do: use nl2sql profile --draft for drafted descriptions, which are filed for review, and nl2sql index --refresh after a glossary change.
  • engine.index.inspect() requires user_context (#348), and shows only the entries that caller's scope reaches. The playground's /api/retrieval takes a role. What to do: pass the caller's UserContext.
  • Store interface version 3 (#329). StateStore gains five proposal methods. What to do: third-party state stores add them and set interface_version = 3.
  • A new QueryResult.status, needs_clarification (#339), and a new error code, COST_LIMIT_EXCEEDED (#342). What to do: handle both. nl2sql run exits 4 when it needs a choice and has no terminal.

What's next

Next: 0.9, Wave C: conversations, chat tools, charts, dashboards, the launchpad, and MCP over HTTP with API keys.

Full changelog: v0.7.0...v0.8.0