SQLite Forge
A full SQLite workbench inside VS Code. Open any .sqlite, .sqlite3, .db, .db3, .s3db or .sl3 file and get a data grid you can edit, a structure editor, and a SQL query workbench — no native modules, works on Windows, macOS and Linux.
Features
Data grid
- Row inspector (Ctrl+I): every field of the selected row listed vertically, editable, with field search. Read a 40-column row without scrolling sideways. Changed fields are highlighted and applied together with Update row (or Enter); Discard or Esc undoes them.
- Pinned columns: the primary key stays visible while you scroll; pin any column from its header menu.
- Columns popover to find, show and hide columns; Fit to panel squeezes all columns into view; compact or comfortable density.
- Paginated grid (50–2,500 rows/page) with sticky headers, resizable columns and row numbers.
- Inline editing: double-click, Enter/F2, or just start typing on a cell. Enter (or the Update button under the cell) applies and moves down, Tab moves right, Esc cancels. Applied edits show Save changes in the header until you save the file.
- Values are coerced by column affinity (typing
12 into an INTEGER column stores an integer, into TEXT stores text).
- Set NULL (Ctrl+Shift+0 or right-click), set empty string, edit long text / JSON in a dialog with pretty-print, hex viewer for BLOBs.
- Insert rows with a form that respects defaults, NOT NULL and auto-increment keys. Duplicate and delete (multi-)selected rows.
- Sort by clicking a header (asc → desc → off).
- Per-column filters with a mini-language:
abc (contains), =42, !=x, >10, <=2024-01-01, 10..20 (between), NULL, !NULL, "".
- Global search across all columns.
- Follow foreign keys: right-click a FK cell → Go to parent row.
- Copy selection/page as CSV, TSV (pastes into Excel/Sheets), JSON, INSERT statements or Markdown.
- Works with rowid tables,
WITHOUT ROWID tables (keyed by primary key) and read-only views.
Structure
- Columns (type, NOT NULL, default, PK, FK, generated), indexes, foreign keys, triggers and highlighted DDL.
- Add / rename / drop columns, create (unique, partial, DESC) indexes, drop indexes, rename / drop / empty tables.
- Create Table designer: PK, AUTOINCREMENT, NOT NULL, UNIQUE, DEFAULT, REFERENCES,
WITHOUT ROWID, STRICT, live SQL preview.
SQL Query workbench
- Editor with syntax highlighting, line numbers, auto-indent, Ctrl+/ comment toggle, Tab/Shift+Tab indent.
- Autocomplete for tables, columns (including
alias. columns resolved from FROM t alias), functions and keywords. Ctrl+Space to force.
- Ctrl+Enter runs everything (or the selection); Ctrl+Shift+Enter runs only the statement under the cursor.
- Multiple statements run in order; each result set is shown separately with row count, timing and rows affected. Errors point at the failing statement.
- EXPLAIN QUERY PLAN as a tree, with full table scans highlighted.
- Format SQL (Shift+Alt+F), snippets (CTE, upsert, duplicates, PRAGMA checks, JSON…).
- History per database and Saved queries across databases.
- Copy or export any result to CSV / JSON / SQL / Markdown.
Import / export
- Import CSV, TSV or JSON into a new table (column types inferred) or an existing one (headers matched case-insensitively). The whole import is one transaction.
- Export a table or query result to CSV, JSON, SQL INSERTs or Markdown.
- Export the whole database as a SQL dump (tables, data, indexes, views, triggers,
sqlite_sequence).
- SQLite Forge activity-bar view listing open databases → tables (with row counts), views, indexes, triggers → columns.
- Right-click: Open, Structure, Select Top 100, Copy name, Drop, New Query, Export dump.
- Run the current
.sql file (or selection) against an open database from the editor title bar.
Live reload
When another program (your app, a migration, a CLI) writes to the database, the open editor reloads automatically, including changes still sitting in the -wal file of WAL-mode databases. If you have unsaved edits, a banner asks before anything is replaced. Turn this off with sqliteForge.autoReload; ⋯ → Reload from disk always works.
Saving model
Changes are made in memory and the editor shows as dirty — Ctrl+S writes the file, Revert discards everything. Hot exit / backups work like any other VS Code document. Turn on sqliteForge.autoSave to write after every change instead.
Settings
| Setting |
Default |
|
sqliteForge.pageSize |
100 |
Rows per page in the grid |
sqliteForge.maxQueryRows |
5000 |
Rows displayed per query result (full count still shown) |
sqliteForge.autoSave |
false |
Write to disk after every edit |
sqliteForge.foreignKeys |
true |
PRAGMA foreign_keys = ON when opening |
sqliteForge.historySize |
200 |
Query history entries kept per database |
Install
code --install-extension sqlite-forge-0.1.0.vsix
or Extensions view → ⋯ → Install from VSIX…
Develop
npm install
npm run build # bundle to dist/
npm test # engine tests (node:test + real SQLite via sql.js)
npm run package # build sqlite-forge-x.y.z.vsix
Press F5 in VS Code to launch an Extension Development Host.
Layout
src/engine.ts Pure SQLite logic (no vscode import) — schema, paging/filters, edits, scripts, dump, import/export
src/provider.ts CustomEditorProvider: document lifecycle, save/revert/backup, webview RPC
src/tree.ts Activity-bar schema explorer
src/extension.ts Activation + commands
media/main.js Webview UI (grid, structure, query workbench) — plain JS
media/main.css Theme-aware styles using VS Code CSS variables
test/ Engine tests
Limitations
- The database is loaded into memory (sql.js / WebAssembly), so very large files (hundreds of MB+) use proportional RAM. Changes are not visible to other processes until you save.
- If another program changes the file while it's open, use Revert to reload it.
- Encrypted databases (SQLCipher) are not supported.
Credits
Icons: Codicons by Microsoft (CC BY 4.0). Database engine: sql.js (MIT), a WebAssembly build of SQLite (public domain). See ThirdPartyNotices.md.
"SQLite" is a registered trademark of Hipp, Wyrick & Company, Inc. This extension is an independent project and is not affiliated with or endorsed by the SQLite developers.
| |