Jupyter-style SQL notebooks for VS Code.
Write SQL in cells, see results in a fast grid, chart them in one click, and let AI write, fix and explain your queries.
Install · Quick start · Features · Connect · AI · Settings · FAQ
- One notebook for every database. MySQL, MariaDB, PostgreSQL and SQL Server. SQLite and DuckDB are built in, so you can start with no server at all.
- Results you can work with. A virtual grid that stays fast with 10,000+ rows. Sort, filter, copy, export, and switch to a chart in one click.
- AI that knows your schema. Write SQL from plain words, fix errors, optimize slow queries and explain results. Use OpenAI, Anthropic, OpenRouter or a local model through Ollama.
- Plain-text notebooks.
.sqlnbfiles are readable SQL, so they diff and review well in Git. - Safe by default. Passwords stay in VS Code's secret storage. Production connections confirm every write. Read-only connections block them.
From the Marketplace: search for SQL Notebook Studio in the Extensions view, or run:
code --install-extension kgptalkie.sql-notebook-studioFrom a file: download the package for your system, then in VS Code open Extensions → ··· → Install from VSIX… These links always give the newest version:
| System | Download |
|---|---|
| Windows (most PCs) | sql-notebook-studio-win32-x64.vsix |
| Windows on ARM | sql-notebook-studio-win32-arm64.vsix |
| Mac with Apple Silicon (M1 and later) | sql-notebook-studio-darwin-arm64.vsix |
| Mac with Intel | sql-notebook-studio-darwin-x64.vsix |
| Linux | sql-notebook-studio-linux-x64.vsix |
| Linux on ARM | sql-notebook-studio-linux-arm64.vsix |
| Alpine Linux | sql-notebook-studio-alpine-x64.vsix |
| Alpine Linux on ARM | sql-notebook-studio-alpine-arm64.vsix |
Or from a terminal, after downloading: code --install-extension sql-notebook-studio-win32-x64.vsix. A file install doesn't update itself; install from the Marketplace once to get updates.
All versions are on the Releases page.
Cursor, Windsurf, VSCodium and other VS Code-based editors: install the file above the same way (Command Palette → Extensions: Install from VSIX…). The extension isn't on Open VSX, so their Extensions search won't find it.
- Open the SQL Notebook Studio view in the activity bar.
- Click Open Sample Notebook. It uses a small shop database that ships with the extension.
- Press Run All, or Ctrl+Enter in a cell.
To make your own notebook, run SQL Notebook Studio: New SQL Notebook, or right-click a .sql file and choose Open as SQL Notebook.
| Key | What it does |
|---|---|
| Ctrl+Enter (Cmd+Enter on Mac) | Run the cell. The view stays where it is. |
| Shift+Enter | Run the cell; it stays selected and moves to one third down the window (setting sqlNotebook.shiftEnterScroll: top, topThird, middle, whenNeeded or off). |
| A / B | Add a code cell above / below (when no cell is being edited). |
| Notebooks | SQL, Markdown and AI cells. Several statements per cell, each with its own result tab. Stop works on every database. |
| Results grid | Virtual scrolling, sort (Shift+click for more columns), filter per column (>10, a..b, !x, null), resize and pin columns, value viewer for long text and JSON. |
| Charts | Bar, line, area, scatter and pie. Pick X and Y, stack series, save the chart with the cell. |
| Query Steps | See the rows after each clause of a SELECT, in the order the database applies them: FROM, JOIN, WHERE, GROUP BY, HAVING, SELECT, DISTINCT, ORDER BY, LIMIT. Each step shows real rows, the row count change, and the rows that step removed. Read-only; works on every database. |
| Explorer | Connections, schemas, tables, views and columns with types and keys. Select Top 100 and Describe in one click. |
| Autocomplete | Tables, views, columns, schemas and keywords from the live schema. Fuzzy and case-blind: slt finds SELECT, EMP finds employees. alias. lists that table's columns. |
| Capital keywords | SQL keywords turn into capitals as you type, using the keyword list of the cell's database. Your table, column and alias names, strings and comments stay as you wrote them. One Ctrl+Z undoes it. |
| Variables | {{name}} asks for a value once per session. ${env:NAME} reads an environment variable. |
| Export | Copy as TSV, CSV, Markdown or JSON. Export results to CSV or JSON, and notebooks to HTML (with charts), PDF or Markdown. |
| Safety | Confirms DROP, TRUNCATE, and UPDATE or DELETE without WHERE. Production tags and read-only connections. |
Click + in the view and fill in the form. Or click Paste connection string: if you already copied one, it is filled in for you.
| Database | Notes |
|---|---|
| MySQL / MariaDB | SSL/TLS, SSH tunnel |
| PostgreSQL | SSL/TLS, SSH tunnel |
| SQL Server | SQL login, Windows (NTLM) or Microsoft Entra ID |
| SQLite | Built in. A file or in memory |
| DuckDB | Built in. A file or in memory. Query CSV and Parquet directly |
- SSL/TLS with CA, client certificate and key.
- SSH tunnel with password, key file or SSH agent.
- Connection strings:
mysql://,postgres://,Server=…;Database=…, or a file path. - Each notebook remembers its connection. A single cell can use another one from its status bar.
![]() |
![]() |
AI is optional and off until you set it up: run SQL Notebook Studio: Configure AI. It works through LangChain, so every provider behaves the same.
| Provider | What you need |
|---|---|
| OpenAI | API key |
| Anthropic | API key |
| OpenRouter | API key |
| Ollama | Ollama running locally. No key, nothing leaves your machine |
| Custom | Any OpenAI-compatible URL |
| Feature | What it does |
|---|---|
| AI cell | Write what you want in plain words. The SQL appears in the next cell, ready to run. Add one with + AI Prompt in the notebook toolbar, or Add AI Prompt Below in any cell's toolbar. |
| Fix with AI | On an error, shows the cause and a corrected query. Apply it in one click. |
| Explain | Explains a query step by step. |
| Optimize | Reads the query plan and suggests a faster query or an index. |
| Explain result | Summarizes what the rows show. Asks before it sends any rows to a cloud provider. |
AI cells and Fix with AI work as an agent. For a task with several parts the model first writes a short plan, then looks up the tables and columns it needs, and checks its SQL against your database before it answers. Nothing is run: SQL Server compiles the SQL under SET NOEXEC ON, the other databases use EXPLAIN. If the check fails, the model fixes the SQL and checks again. The AI card shows the plan and each step while it works, then folds them into How this answer was made. Agent mode needs a model with tool calling; with one that has none, the answer is made the direct way and the card says so. Set sqlNotebook.ai.mode to direct for one quick call with no checks.
Only the schema (table and column names) is sent with your request, unless you allow result data. With a local model, or with result data allowed, the agent may also read 5 rows of a table to see what the values look like.
The answers are only as good as the model. Small local models (around 4B parameters) give poor results; use about 27B or more, or a free or paid AI API. See Choosing an AI model.
![]() |
![]() |
A notebook is plain SQL with comment markers, so it reads well in any editor and in a Git diff:
-- sqlnb v1 {"connection":"Sample Shop"}
-- %% md
-- ## Top products
-- %% sql
SELECT name, price
FROM products
ORDER BY price DESC;| Setting | Default | What it does |
|---|---|---|
sqlNotebook.results.maxRows |
10000 |
Rows kept per result |
sqlNotebook.queryTimeoutSeconds |
0 |
Query timeout. 0 means none |
sqlNotebook.saveResults |
false |
Save results in the notebook file |
sqlNotebook.confirmDestructive |
production |
When to confirm risky statements |
sqlNotebook.editor.uppercaseKeywords |
true |
Turn SQL keywords into capitals as you type |
sqlNotebook.autocomplete.keywordCase |
upper |
Case of inserted keywords: upper, lower, or auto to follow what you type |
sqlNotebook.export.maxRows |
500 |
Rows per result in exported files |
sqlNotebook.ai.provider |
openai |
AI provider |
sqlNotebook.ai.model |
Model name, for example qwen3.8:27b for Ollama |
|
sqlNotebook.ai.baseUrl |
Custom or Ollama URL | |
sqlNotebook.ai.mode |
agent |
agent: AI cells and Fix plan, look up tables and check the SQL. direct: one call, no checks |
sqlNotebook.ai.allowResultData |
false |
Send rows to AI without asking |
sqlNotebook.ai.runGeneratedSql |
false |
Run SQL from an AI cell at once |
Do I need a database server to try it? No. The sample notebook runs on the built-in SQLite. DuckDB is built in too.
Where are my passwords stored? In VS Code's secret storage (your OS keychain). Never in settings or in the notebook file.
Can I use AI without sending data to the cloud? Yes. Choose Ollama and run a local model. Nothing leaves your machine.
The AI's answers are poor. Which model should I use? The answers depend on the model you choose, not on SQL Notebook Studio. Every model gets the same instructions and schema. Small local models (around 4B parameters) are not good enough; use about 27B to 32B. If your computer can't run that, use a free AI API such as OpenRouter, Google Gemini, xAI Grok or NVIDIA NIM, or a paid one (OpenAI, Anthropic). See Choosing an AI model for setup steps.
How does it know which words are SQL keywords?
Each notebook has a connection, so it knows the database: the toolbar shows it, for example Sample Shop · SQLite. The keyword list for MySQL, PostgreSQL, SQL Server, SQLite or DuckDB comes from the sql-formatter library, so it stays current with that project. Names in your database are never changed, so a column called name or status stays as it is. To turn it off, run SQL Notebook Studio: Toggle Uppercase Keywords or untick the setting.
Can I open my existing .sql files?
Yes. Right-click a .sql file and choose Open as SQL Notebook. Each statement becomes a cell.
Which platforms are supported? Windows, macOS and Linux (x64 and arm64), including Alpine.
Can't connect, or a connection stops working? See TROUBLESHOOTING.md: error messages and fixes for each database, for example SQL Server letting only one notebook connect at a time.
npm install
npm run build # bundle the extension, renderer and webview
npm test # unit and driver tests
npm run package:all # one .vsix per platform in vsix/Press F5 in VS Code to start an Extension Development Host.
Releasing. Raise version in package.json, add the changes to CHANGELOG.md, commit, then push a matching tag:
git tag v1.0.1
git push origin v1.0.1The Publish workflow tests, builds the 8 platform packages and publishes them to the Marketplace. It uses Trusted Publishing, so no token is stored anywhere.
Bug reports and ideas are welcome in Issues. For a pull request, please open an issue first so we can agree on the change.
Apache License 2.0 © 2026 KGP Talkie
You can use, change and share this code, also in commercial work. If you publish it, or a work based on it, keep the NOTICE file with it and credit SQL Notebook Studio by KGP Talkie with a link to this repository.
Third-party software included in the extension is listed in THIRD-PARTY-NOTICES.txt.
The license covers the code, not the names. "SQL Notebook Studio", "KGP Talkie" and the SQL Notebook Studio logo are not licensed for use by forks. If you publish a fork, give it your own name and logo.
Made by KGP Talkie · If it helps you, please ⭐ the repo and rate it on the Marketplace.










