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
yamlglossary first) are merged, filtered by the caller's scope and shown or exported withengine.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 --refreshre-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 withdraft=Truetheprofilermodel 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_clarificationwith 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 anexplanation, written from the typed plan, not from model text. - A cost guard and corrections.
policies.costis enforced: over the limit, a query is allowed, held for approval or refused asCOST_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, andprobe_overlapon all five built-ins (#332). explanationonQueryResult: why this answer, rendered from the typed plan (#335).- Knowledge sources, merge, scope filter,
showandexport, and theyamlsource 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_clarificationresult (#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.costhook (#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=onrun_queryandstream_query,save_choice, settled phrases, a prompt innl2sql runon a terminal, andchoiceon the MCPasktool (#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
columnsis the prose half of a metric. - SQLite has no cost estimate, so the cost rule treats its queries as
unknown.
Upgrading
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-onlyand theirenrich=andcurated_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: usenl2sql profile --draftfor drafted descriptions, which are filed for review, andnl2sql index --refreshafter a glossary change.engine.index.inspect()requiresuser_context(#348), and shows only the entries that caller's scope reaches. The playground's/api/retrievaltakes arole. What to do: pass the caller'sUserContext.- Store interface version 3 (#329).
StateStoregains five proposal methods. What to do: third-party state stores add them and setinterface_version = 3. - A new
QueryResult.status,needs_clarification(#339), and a new error code,COST_LIMIT_EXCEEDED(#342). What to do: handle both.nl2sql runexits 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