SQL Workbench
SQL-first database workbench for VS Code.
SQL Workbench keeps database work inside the editor: write SQL in normal .sql files, switch the active connection from the status bar, inspect schema metadata, and run statements without a paid feature wall.
简体中文 • Repository


Why SQL Workbench?
| Capability |
What it changes |
| SQL-first editing |
SQL stays in native VS Code editors, so formatting, snippets, search, Git, and shortcuts work as expected. |
| Active connection switching |
Use the status bar or tree commands to switch the active database for the current SQL workflow. |
| Read-only schema inspection |
Click a table to inspect columns, types, lengths, comments, nullability, and keys without enabling accidental GUI writes. |
| Alias-aware completions |
bs. only suggests fields from the table aliased as bs, with comments and types in the suggestion list. |
| Safe MVP boundary |
Result grids and schema views are read-only. Data and schema changes must be made through SQL. |
Screenshots
Read-only schema inspector

Alias-aware SQL completion

MVP Features
- MySQL/MariaDB, PostgreSQL, and SQLite connection profiles.
- Grouped database tree in the VS Code activity bar.
- Webview connection form with save and test connection actions.
- Shortcut connection strings such as
mysql://root:password@127.0.0.1:3306/app?name=prod&group=sr.
- Passwords stored in VS Code
SecretStorage; non-secret metadata stored in extension globalState.
- Active connection status bar item and QuickPick switcher.
- SQL snippets and completions for keywords, tables, and scoped columns.
Cmd+Enter on macOS or Ctrl+Enter on Windows/Linux runs the current SQL statement.
- Read-only result webview for query output.
- Read-only schema tree: connection -> tables -> table -> columns.
- Read-only table column inspector opened beside the editor.
Quick Start
# Install dependencies.
npm install
# Validate TypeScript types without writing build output.
npm run check
# Compile extension sources into out/.
npm run compile
# Start locally:
# open this folder in VS Code, press F5, and use the Extension Development Host.
After the extension starts:
- Open the
Database activity bar view.
- Click
Add Connection.
- Fill the form or paste a shortcut connection string.
- Use
Test Connection, then Save.
- Open or create a
.sql file and run the current statement with Cmd+Enter or Ctrl+Enter.
Shortcut Connection Strings
Supported examples:
mysql://root:password@127.0.0.1:3306/app?name=local-mysql&group=local
postgresql://postgres:password@127.0.0.1:5432/app?name=local-pg&group=local
sqlite:///Users/me/database.sqlite?name=local-sqlite&group=local
Supported schemes:
mysql://
mariadb://
postgresql://
postgres://
sqlite://
Versioning
Current MVP release line: 0.1.x.
- MVP fixes and small improvements: bump patch versions, for example
0.1.1.
- Larger feature updates before the full release: bump minor versions, for example
0.2.0.
- Full version with the planned complete feature set: bump major version to
1.0.0.
Local Verification
# Type-check the project.
npm run check
# Build the extension output used by VS Code.
npm run compile
# Regenerate README screenshots after UI changes.
npm run screenshots
# Package a local VSIX for installation testing.
npx --yes @vscode/vsce package
# Optional: choose a non-default Chrome executable for screenshot generation.
CHROME_PATH="/path/to/chrome" npm run screenshots
How It Works
- Connections are saved through
ConnectionStore.
- SQL execution is routed by database type:
- SQLite uses
sql.js.
- MySQL/MariaDB uses
mysql2.
- PostgreSQL uses
pg.
- Schema metadata is loaded through database-specific inspectors.
- SQL completions parse the current statement, resolve aliases from
FROM and JOIN, and scope fields to the matching table.
- Results and schema views render as read-only webviews.
MVP Boundary
The MVP intentionally does not support editing result cells, editing columns, or deleting schema objects through the UI. Those actions must be performed with SQL. Inline editing can be revisited after the read-only SQL workflow is stable.
Roadmap
0.1.x: MVP fixes, SQL completion refinements, and connection-form polish.
0.2.x: Extension-level configuration for custom execution shortcuts.
0.2.x: Better packaging through bundling to reduce VSIX size.
0.2.x: Richer connection editing and import/export.
0.3.x: Query history and result export refinements.
1.0.0: Complete planned feature set.
FAQ
Can I run writes?
Yes. Writes are supported through SQL execution. The UI does not provide result-cell or schema-object editing in the MVP.
Where do SQL files live?
They live in your normal VS Code workspace as .sql files. The extension does not require a proprietary query document format.
How are passwords stored?
Passwords are stored in VS Code SecretStorage. Normal connection metadata is stored in extension globalState.