Open-source text-to-SQL you can tune to your database.
mnemiq turns natural-language questions into SQL for PostgreSQL, SQLite, DuckDB, Oracle, Snowflake and Databricks. Configure the model and schema context, validate proposed queries before execution, and evaluate correct answers, refusals and errors on your own data.
/NEM-ik/ — the “m” is silent, as in mnemonic · Apache-2.0
An open-source text-to-SQL engine, not a hosted BI tool.
mnemiq is an open-source text-to-SQL engine published by Agentic Fabriq under the Apache License 2.0. It is a Python package you install and run yourself, inside your own environment, on a language model you choose. It ships its own evaluation harness, because no accuracy number applies to your database until you have run it on your database.
- Licence
- Apache-2.0, for the whole engine: enrichment, the decider, the access checks, the grader hooks and the benchmark harness. The grader itself is Apache-2.0 in a separate repository, so the engine does not mark its own homework.
- Databases
- PostgreSQL, SQLite, DuckDB, Oracle, Snowflake and Databricks, with DuckDB as the universal executor. The semantic model is open, and dbt-semantic-interfaces import and export ship with it.
- Local and self-hosted models
- Any OpenAI-compatible
/v1endpoint, set throughMNEMIQ_LLM_BASE_URL: vLLM, Ollama, llama.cpp’s server, LM Studio, vendor gateways and the hosted APIs. Embeddings follow the same setting or take their own viaMNEMIQ_EMBED_*. Point it at a local server and no schema, question or row leaves your network. - What deployment requires
- An OpenAI-compatible model endpoint; a first
uv syncthat pulls roughly 230 MB of dependencies; one enrichment pass per schema, cached afterwards, which is the only slow step (around 30 seconds for the demo’s four tables and longer in proportion to yours); and a source manifest plus an access policy. Access is fail-closed: with no role, no grants and no snapshot, the engine returns nothing. The demo needs neither a database of your own nor Docker.
The maintained repository is github.com/agenticfabriq/mnemiq, and the commands that run it on a clean clone are further down this page and in the README quickstart.
The model proposes. Deterministic code decides.
mnemiq separates writing SQL from deciding to run it. The model appears once, at stage 05. Everything before and after it is deterministic, and every answer carries a trace. Permissions apply before schema retrieval, so the model is never shown a table the caller may not see.
- 01
Knowledge sources
The database, plus any dictionary, glossary or code system you hand it.
- 02
Enrichment
Profiles every column and builds descriptions, grain and coded-value meanings. Cached per schema.
- 03
Semantic contract
Definitions a named owner can certify. The operator’s dictionary overrides anything the model proposed.
- 04
Retrieval
Only the schema the caller may see is retrieved, so a forbidden table is never named.
- 05 · the only model stage
Generation
A language model proposes SQL. One candidate or several, hosted or local.
- 06
Decider
Read-only? Allowed objects only? Compiles in the source dialect? Survives EXPLAIN? Fail any, get a refusal with a reason.
- 07
Execution
Runs under row and column policy applied to the query tree, not requested of the model.
- 08
Verification
A judge can defer an answer it cannot support. Threshold is a setting.
- 09
Answer with trace
The SQL that ran, the tables it touched, the enrichment version behind it.
The parts people usually cannot reach are settings here: which model writes the SQL, how much schema context is retrieved, how much semantic enrichment is built and whether a human certifies it, how aggressively the system refuses, and what the decider enforces. Each is a dial with a cost on the other side, which is why they are dials and not defaults.
Six databases. One executor.
DuckDB is the universal executor. The semantic model is open, and dbt-semantic-interfaces import and export ship with it. Any OpenAI-compatible endpoint serves the model, so a local server keeps every schema, question and row inside your network.
- PostgreSQL
- SQLite
- DuckDB
- Oracle
- Snowflake
- Databricks
Built for teams who will configure and measure it.
mnemiq fits a team that is willing to configure an engine against its own schema and then measure what comes out. It is not turnkey managed analytics, and it is not a BI product: nobody hands you an accuracy number that holds on your warehouse, because that number depends on your tables, your business definitions and the model you point it at.
Operating work you own
Running enrichment per schema and re-running it when the schema changes, choosing and paying for a model endpoint, and keeping the deployment up.
Definitions somebody writes
The dictionary and glossary that override what the model guessed are yours to write and certify. Coded columns and business terms do not document themselves.
Access policy you author
Sources, roles and grants are configuration files. Access is fail-closed, so a deployment with no policy returns nothing until you write one.
An evaluation you repeat
Your own question set, your own grading rule, repeated runs, and refusals counted apart from wrong answers — before and after every configuration change.
If nobody on the team will own that work, a hosted analytics product with a vendor-managed semantic layer is the more honest choice. If somebody will, the method for getting a number that applies to your data is written up in how to evaluate text-to-SQL on your own database.
The numbers, with the rule beside them.
Each product ran on its own platform with its own semantic tooling, on the same questions, with the same external grader and three runs per cell where possible. Every cell reads exact match / got-the-facts: exact match requires the same rows and columns as the reference; got-the-facts counts an answer that contains the reference result. The two rules can rank systems in different orders, which is why both are shown.
| System | BIRD mini-dev | Spider 1.0 | Spider 2.0-lite |
|---|---|---|---|
mnemiq tier 2 enrichment, hosted frontier model | 52.2 / 64.9 | 68.4 / 79.5 | 36.6 / 59.8 |
Databricks Genie | 37.4 / 53.1 | 63.6 / 77.5 | 27.3 / 45.5 |
Snowflake Cortex Analyst | 33.3 / 48.9 | 56.4 / 77.1 | 17.4 / 24.2 |
These are first-party results published by the developer of one of the systems compared. The vendor models are undisclosed, and none of these benchmarks tells you what will happen on your warehouse. The grader, the tracker and the per-question results are open in Beacon; the methodology is in the launch article.
Runs on a clean clone.
No database of your own and no Docker needed: the seed step writes a small SQLite database plus its source manifest and access policy. Access is fail-closed, so a role is required. Without one the engine grants nothing and defers.
uv sync
uv run python scripts/seed_demo.py
export MNEMIQ_LLM_BASE_URL=... MNEMIQ_LLM_API_KEY=... MNEMIQ_LLM_MODEL=...
export MNEMIQ_SOURCES_PATH=demo/sources.json
export MNEMIQ_AUTHZ_PATH=demo/authz.json
export MNEMIQ_STORE_PATH=demo/store.duckdb
uv run mnemiq enrich # profile + describe the schema
uv run mnemiq build # index it for retrieval
uv run mnemiq ask "how many customers are there by country?" --roles analystThree tools. Writes off by default.
A client’s tools/list against mnemiq serve sees three: db_read(question, mode), which returns the answer with its SQL and trace, get_schema(), and db_write(sql). All three are access-scoped. Point any MCP client at it:
{ "mcpServers": { "mnemiq": { "command": "mnemiq", "args": ["serve"] } } }db_write is registered but inert unless two locks are both open: the access policy has to grant write on the target, and MNEMIQ_WRITE_ENABLED has to be set, which defaults to False. The deployment switch is checked first, before statement shape or authorisation, so a default deployment refuses every write with a stated reason — and with writes off the source is attached read-only as a backstop.
One process also serves a workbench and an HTTP API (POST /v1/ask, POST /v1/chat, GET /v1/schema). Every answer shows the SQL that produced it and the tables it read.
- gitmnemiq on GitHubApache-2.0 · engine, enrichment, grader, harness
- gitBeacon on GitHubThe grader and results tracker behind the numbers
- postLaunch articleDesign, benchmarks and methodology
- pdfThe mnemiq paperPDF
- pdfTechnical reportPDF · DOI 10.5281/zenodo.22806094
- sayTalk to usVerity and the Agentic Fabriq control plane
Common questions about mnemiq.
mnemiq is an open-source (Apache-2.0) text-to-SQL engine for enterprise data agents. A language model proposes SQL; deterministic checks on shape, access, dialect and query plan decide whether it runs. It is built to be configured and measured on your own database.
Canonical URL: https://www.agenticfabriq.com/mnemiq · Maintained by Agentic Fabriq