QuerySmith
A SQL workbench inside VS Code. Connect to Postgres, MySQL, SQL Server or DuckDB, browse and run queries, chart results, get AI help tuning queries, draw ER diagrams, design data models, and run multi-step SQL pipelines on a schedule. You don't need a separate desktop app.
Quick start
- Click the QuerySmith icon in the activity bar.
- Click + (Add Connection), pick an engine and fill in the details. For DuckDB, point it at a
.duckdb file.
- Open a
.sql file and run QuerySmith: Pick Connection to bind it.
- Press
Cmd+Enter (macOS) or Ctrl+Enter to run. Results open beside the editor.

Features
Connections and object explorer
- One Connections tree for every saved database: databases, schemas, tables, views, functions and procedures.
- Right-click a table or view to use Select Top 100, Show Columns or Show Relationships.
- Right-click a database or schema to use Create Schema, Create Table or Drop. Drop actions are grouped separately so you don't click them by accident.
- On functions and procedures, Show Details lists parameters, and Generate Call writes the invocation SQL for you.
- You can Edit, Disconnect or Delete a connection from its context menu.
Smith SQL editor
.sql files open with Smith SQL highlighting.
- Run the whole file or a selection with
Cmd/Ctrl+Enter, or use the Run button in the editor title bar.
- Each file remembers its own connection. Switch any time with Pick Connection.
Results grid and charts
- Results open in a grid panel next to your query.
- One click turns the result into a chart built on Vega-Lite. QuerySmith recommends a chart type from the shape of your columns.
- Choose bar, line, area, point, boxplot, pie, histogram and more. Use Simple for quick picks, Explorer to map any column to x, y and color, or Dashboard to see several charts side by side.
- Recommend charts asks the AI model for chart ideas, and Change model switches providers.
- History keeps past recommendation runs for the current connection, grouped by provider, so closing the cards doesn't lose them. Open brings a run back.
- Export the chart as SVG, PNG or a standalone HTML file, or choose Host on Web (live) to serve it at
127.0.0.1 and view it in your browser.

Query optimization
- Optimize runs
EXPLAIN for the last SELECT and lists concrete tips, such as full scans, missing filters or large sorts.
- The Plan tab shows the raw query plan, with Refresh and Copy plan.
- AI rewrite suggests a faster version of the query using OpenAI, Anthropic or a local Ollama model. Choose Local signals only to keep everything offline. Apply to editor replaces your query, or Copy SQL copies it.
- API keys are stored in VS Code Secret Storage, and you can use
OPENAI_API_KEY or ANTHROPIC_API_KEY from the environment instead.

ER diagrams
- Visualize Relationships draws the tables and joins referenced in the current query.
- Show Relationships on a table shows its foreign-key neighbors.
- Build ER Diagram… on a schema or database draws the whole thing interactively.
- Solid lines are declared foreign keys, and dashed lines are joins found in your queries. Use Keys only to hide other columns, Model hints to tag tables as fact, dimension, SCD or append-only, and search, zoom and Fit to navigate large schemas. Recommend model asks the AI to suggest a modeling approach for the diagram.
- Add objects pulls more tables in. Generate model turns the diagram into a data model, built either by Graph Builder or with AI (AI Augmented).

Data models (*.qsmodel.json)
- New Data Model, New Data Model from Tables… (right-click a schema) or Draft Model with AI….
- The AI draft supports Kimball (star schema), Inmon (3NF), Data Vault (hubs, links and satellites), or lets the AI choose the best fit.
- The Graph Builder lets you add tables, columns, types, keys and relationships visually.
- Preview DDL Plan shows the exact
CREATE and ALTER statements before anything runs. Apply Model… executes them against a connection.
- Seed Data with AI… generates realistic sample rows per table from a scenario you describe.
- Show Model in ER Diagram renders the model. Model files are validated against a JSON schema as you type.
Steps: SQL pipelines
Split a .sql file into named steps with dependencies:
STEP raw_orders AS
CREATE OR REPLACE TABLE stage.orders AS SELECT * FROM src.orders;
STEP daily_sales DEPENDS ON raw_orders AS
CREATE OR REPLACE TABLE mart.daily_sales AS
SELECT order_date, sum(amount) AS revenue FROM stage.orders GROUP BY 1;
- Open Steps Panel shows the dependency graph with live status for each step (pending, running, succeeded, failed or skipped).
- Each step gets Run step and Run from here links right in the editor, and a check mark once it succeeds.
- Run everything, run from a step, or run only one step. When a step fails, the panel shows the error, the failing statement and the step SQL, with Show in editor, Rerun step and Copy error.
- Run history keeps each run's trigger, timing and outcome. Show tables in ER diagrams the tables the pipeline built.
- Right-click any table and choose Add as Pipeline Step to start a pipeline from existing data.
- Schedule Steps Pipeline saves a cron schedule to
.querysmith/pipelines.json. Scheduled runs only happen while VS Code is open, and missed runs are not backfilled.
- Steps Local API lets scripts trigger runs over HTTP:
POST /pipelines/<name>/runs starts a run, and GET /runs/<id> checks it.
- The API binds to
127.0.0.1 only, requires an Authorization: Bearer <token> header and sends no CORS headers.
- It's off until you enable it.

Supported databases
| Engine |
Notes |
| PostgreSQL |
Full explorer, EXPLAIN-based optimize |
| MySQL |
Full explorer, EXPLAIN-based optimize |
| SQL Server |
Full explorer; optimize uses local tips (no query plan yet) |
| DuckDB |
Local .duckdb files, read_csv_auto and friends |
| Snowflake |
Database / schema / table explorer, declared keys in ER; password, key pair or OAuth token auth; EXPLAIN USING TEXT optimize |
| Databricks |
Unity Catalog catalog / schema / table explorer, informational keys in ER; personal access token or OAuth auth; EXPLAIN FORMATTED optimize. Delta, Iceberg and Hudi tables via the catalog |
| ksqlDB |
Streams / tables explorer; pull queries, live EMIT CHANGES push queries in Results with Stop; STEP … STREAM deploys persistent queries and SINK appends them into another connection; basic auth / API key |
| Kafka |
Topic browser with columns inferred from JSON messages; SELECT … FROM <topic> LIMIT n reads the newest messages, EMIT CHANGES tails live; SASL (plain / SCRAM) and TLS |
Settings
| Setting |
Default |
Description |
querysmith.steps.apiPort |
7788 |
Port for the Steps Local API (always 127.0.0.1). |
querysmith.charts.recHistoryDays |
7 |
Days to keep chart recommendation history (1 to 14). |
Privacy
- Credentials and API keys are kept in VS Code Secret Storage.
- Nothing is sent to an AI provider unless you pick one. Ollama and Local signals only keep data on your machine.
- Live charts and the Steps API only listen on
127.0.0.1.
Requirements
VS Code 1.85 or newer. You need network access to your database server, unless you use DuckDB.
| |