Curie — Local Text2SQL for PostgreSQL and SQLite
Curie is a VS Code extension that turns natural-language questions into
PostgreSQL or SQLite queries. It runs a fine-tuned Qwen model locally, so schema
context and query generation stay on your machine.
Curie was developed as a university project for local, understandable Text2SQL
workflows.
Academic use and licensing
Curie was developed as a non-commercial student project for a Technical
University of Munich (TUM) module and is intended for research and evaluation.
Improved using Qwen. The selectable Curie compact (0.5B) and Curie medium
(1.5B) adapters are based on models licensed under the Apache License 2.0.
The default Curie standard (3B) adapter is subject to the
Qwen Research License Agreement.
Commercial use of the 3B model or adapter requires separate permission from
Alibaba Cloud. The adapters were trained using the
Spider dataset, licensed under
CC BY-SA 4.0.
What you can do
- Connect to a PostgreSQL database or select a local SQLite file from the Curie
sidebar.
- Inspect tables, columns, primary keys, and foreign-key relationships.
- Switch between the bundled Curie compact (0.5B), Curie medium (1.5B), and
Curie standard (3B) adapters.
- Select the tables that should be included in the model context.
- View the selected schema as a table list or Mermaid ER diagram.
- Generate SQL for the selected database from questions written in natural
language.
- Review and edit generated SQL before running it.
- Run a query and view up to 100 returned rows directly in VS Code.
- Copy query results as tab-separated values for use in a spreadsheet.
For example, ask:
Which customers placed the most orders last month?
How it works
- Curie starts a managed, isolated Python environment on your computer.
- It installs the
curie-backend package when needed and starts the local API
on 127.0.0.1.
- You load and select the relevant PostgreSQL or SQLite schema.
- Curie combines your question with that schema and generates SQL using the
selected local Qwen model.
- You review the query and may run it against the configured database.
The initial setup can take several minutes: the Python backend, its dependencies,
and the public Qwen base model may need to be downloaded. Subsequent starts use
the locally stored environment and model cache.
The backend package contains roughly 220 MB of uncompressed adapter data. Each
selected public Qwen base model is downloaded separately on first use, so
ensure that additional disk space is available for the Hugging Face model
cache.
Requirements
- VS Code 1.105 or newer
- Python 3.10 or newer
- A reachable PostgreSQL database or local SQLite database file
- Sufficient local memory and disk space for the selected Qwen model
- Internet access for the initial backend installation and model download
Get started
- Install the extension and open Curie from the Activity Bar.
- Wait until the backend status shows Running. If prompted, choose
Install backend.
- In Database, choose PostgreSQL and enter its connection details, or
choose SQLite and select a local database file. Then select Load schema.
- Select the tables relevant to your question.
- Enter a question and select Generate SQL.
- Review or edit the generated statement.
- Keep Read-only transaction enabled and select Run SQL when ready.
Privacy and safety
- Model inference runs locally; Curie does not use a hosted inference service.
- The backend listens only on
127.0.0.1.
- Database credentials and the selected SQLite path are stored with VS Code
SecretStorage, not in the saved webview state.
- Curie does not collect telemetry.
- SQL execution accepts one statement per request and returns at most 100 rows.
- Read-only execution is enabled by default for PostgreSQL and SQLite.
Generated SQL can be incorrect or unsafe for your data. Always review it before
execution. Disable read-only mode only when you intentionally want to run a
statement that changes the database.
Commands
Open the Command Palette and search for Curie:
Curie: Open Text2SQL Assistant
Curie: Start Backend Server
Curie: Stop Backend Server
Settings
| Setting |
Default |
Description |
dbAssistant.backendPort |
8000 |
Local port for the Curie backend. |
dbAssistant.autoStartBackend |
true |
Start the backend when the extension activates. |
dbAssistant.backendPythonPath |
Auto-detected |
Optional Python 3.10+ interpreter used to create Curie's managed environment. |
Troubleshooting
Python was not found
Set dbAssistant.backendPythonPath to a Python 3.10+ interpreter, for example:
/usr/local/bin/python3
The backend cannot start
Open View → Output, select Curie Backend, and inspect the installation
or model-loading log. If the configured port is already in use, select a different
dbAssistant.backendPort and restart the backend.
Recover an interrupted backend installation
First select Start backend again and repeat the installation. If the managed
Python environment itself remains unusable, close all VS Code windows before
recreating it with the commands below.
These paths apply to the standard VS Code installation. VS Code Insiders and
other distributions use a different user-data directory.
macOS
CURIE_ENV="$HOME/Library/Application Support/Code/User/globalStorage/curie.curie-text2sql/backend-venv"
python3 -m venv --clear "$CURIE_ENV"
"$CURIE_ENV/bin/python" -m pip install --upgrade --index-url https://gitlab.lrz.de/api/v4/projects/256925/packages/pypi/simple curie-backend==0.2.8
Linux
CURIE_ENV="$HOME/.config/Code/User/globalStorage/curie.curie-text2sql/backend-venv"
python3 -m venv --clear "$CURIE_ENV"
"$CURIE_ENV/bin/python" -m pip install --upgrade --index-url https://gitlab.lrz.de/api/v4/projects/256925/packages/pypi/simple curie-backend==0.2.8
Windows PowerShell
$CurieEnv = Join-Path $HOME ".curie\backend-venv"
py -m venv --clear $CurieEnv
& (Join-Path $CurieEnv "Scripts\python.exe") -m pip install --upgrade --index-url https://gitlab.lrz.de/api/v4/projects/256925/packages/pypi/simple curie-backend==0.2.8
Reopen VS Code and select Start backend. This recreates only Curie's managed
Python environment; saved database credentials and the separate Hugging Face
model cache are not removed.
The database connection fails
Check the host, port, database name, username, password, and SSL mode. Also
confirm that PostgreSQL accepts connections from the computer running VS Code.
For SQLite, confirm that the selected local file still exists and is readable.
The first start takes a long time
This is expected while Curie installs the backend dependencies or downloads the
base model. Keep VS Code open and check Curie Backend output for progress.