Curie — Local Text2SQL for PostgreSQL
Curie is a VS Code extension that turns natural-language questions into
PostgreSQL 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.
What you can do
- Connect to a PostgreSQL database from the Curie sidebar.
- Inspect tables, columns, primary keys, and foreign-key relationships.
- Select the tables that should be included in the model context.
- View the selected schema as a table list or Mermaid ER diagram.
- Generate PostgreSQL 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 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.
Requirements
- VS Code 1.105 or newer
- Python 3.10 or newer
- A reachable PostgreSQL database
- Sufficient local memory and disk space for the selected Qwen model
- Internet access for the initial backend installation and model download
Curie currently supports PostgreSQL only.
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, enter the host, port, database, username, password, and SSL
mode, 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 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 transactions are enabled by default.
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.
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.
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.