SQL Workbench for Databricks
Write and run SQL on Databricks SQL warehouses from VS Code. Browse Unity Catalog in the sidebar,
get autocomplete for catalogs, schemas, tables and columns, run the statement under the cursor with
Ctrl+Enter (Cmd+Enter on macOS), and see results in a grid. It works behind company networks that
inspect TLS, and it can let GitHub Copilot (agent mode) and other MCP clients browse and query your
data safely: read-only by default, and the AI never sees a secret or token.
Unofficial. This is a community project. It is not made, supported or endorsed by Databricks.
"Databricks" and "Unity Catalog" are trademarks of Databricks, Inc.
Status: early release (0.x). Everything runs over the documented Databricks REST APIs. The extension is
tested against a fake workspace (over HTTPS with a corporate CA) and inside VS Code; please
open an issue if something does not
work with your workspace.

Install
- VS Code Marketplace: search for SQL Workbench for Databricks in the Extensions view, or run
code --install-extension notsujansharma.sql-workbench-for-databricks.
- From a .vsix file: download
sql-workbench-for-databricks-<version>.vsix from the
GitHub releases, then in the
Extensions view click … → Install from VSIX….
Needs VS Code 1.95 or later. The MCP integration for Copilot needs VS Code 1.101 or later; older versions get
the same tools as Copilot "language model tools" instead.
Quick start
- Click the Databricks SQL icon in the activity bar, then Add Connection. Pick how to sign in (see
Sign-in modes), then use Browse… to choose a SQL warehouse (and, if you like, a
default catalog and schema). Test Connection signs in and checks the warehouse and Unity Catalog.
- Click Save & Connect. The connection opens in the sidebar: its warehouse, then catalogs → schemas →
tables and views → columns. Browsing uses the Unity Catalog API, so it does not start the warehouse.
- Click New SQL File (or right-click a schema or table), write SQL and press Ctrl+Enter
(Cmd+Enter) to run the statement under the cursor, or Ctrl+Shift+Enter (Cmd+Shift+Enter) to run
the whole file. A stopped warehouse starts by itself; the status bar says when a query is waiting for it.
On a company network that inspects TLS (you need a corporate .crt file for your scripts), run
Databricks SQL: Set Up Corporate Certificate first. See Corporate networks.
Writing SQL
- Run the statement under the cursor with Ctrl+Enter (Cmd+Enter), the selection if there is one,
or the whole file with Ctrl+Shift+Enter. Every statement also has a ▶ Run link above it. The part
that ran is highlighted briefly, and errors are underlined where Databricks reports them
(for example
TABLE_OR_VIEW_NOT_FOUND on the table name) and listed in Problems.
- Each SQL file remembers its connection, catalog and schema, shown on its first line and in the status
bar. Click it to change them, or use Set Catalog and Schema. Running
USE CATALOG … or USE SCHEMA …
changes them for the file too. A file without its own connection uses the one you used last.
- Autocomplete and hover come from Unity Catalog: catalogs, schemas, tables and views after
FROM /
JOIN / DESCRIBE, the tables of catalog.schema., and the columns of alias. or table.. Names are
backtick-quoted when they need it. Hover a table to see its columns, or a column to see its type, comment
and whether it is a partition column. Autocomplete only works once the connection has signed in, so typing
never opens a sign-in prompt.
- Query history in the sidebar keeps what you ran (never the results), on this computer only: open it,
run it again, copy it or search it. Passwords in SQL are masked.
- Right-click a table for Preview Rows (first 100), New Query for This Table, Show CREATE
Statement or Copy Name (
catalog.schema.table, quoted where needed).

How statements run. Each statement is sent to the warehouse on its own through the
Statement Execution API. There is no
session between statements, so SET options, temporary views and session variables do not carry over
from one statement to the next. USE CATALOG and USE SCHEMA do, because the extension keeps track of them
for each file. A BEGIN … END block (SQL scripting) is one statement and keeps its own variables. Up to
dbsqlWorkbench.maxRows rows (1,000 by default) are fetched per statement; the grid says when there were
more. Cancel (in the grid, the editor title bar or the status bar menu) cancels the statement on the
warehouse.
Sign-in modes
Every mode ends at the same place: a Databricks access token for the workspace. Secrets are kept only in
VS Code's SecretStorage (your operating system's credential store); tokens are kept only in memory.
| Mode |
What you need |
| Azure service principal (client secret) |
Workspace URL, tenant ID, client ID, client secret value from the Azure portal |
| Databricks service principal (OAuth secret) |
Workspace URL, client ID, an OAuth secret generated in Databricks |
| Sign in as myself (Microsoft account in VS Code) |
Workspace URL, optional tenant ID |
| My Azure CLI login |
az login done in a terminal, workspace URL, optional tenant ID |
| Databricks CLI profile |
A profile in ~/.databrickscfg (%USERPROFILE%\.databrickscfg on Windows) |
- The Azure modes work only with Azure Databricks (
*.azuredatabricks.net). The Databricks service principal
and CLI profile modes work on Azure, AWS and GCP.
- Sign in as myself uses VS Code's built-in Microsoft sign-in. Some tenants require an admin to consent
to VS Code accessing Azure Databricks; if you see a consent error, use My Azure CLI login instead.
- Databricks CLI profile: profiles created by
databricks auth login are signed in by running
databricks auth token -p <profile> (set dbsqlWorkbench.databricksCliPath if databricks is not on your
PATH). Profiles that hold a service principal secret, a personal access token or auth_type = azure-cli
are signed in directly with those values, so a profile meant for a service principal cannot quietly fall
back to your personal login.
After signing in, the extension asks Databricks who the token belongs to and shows it. If a
service-principal connection turns out to be signed in as a person (or the other way round), you get a
warning. Show Diagnostics walks through certificates, sign-in, Unity Catalog and the warehouse step by step.
The identity needs CAN USE on the SQL warehouse to run queries, and USE CATALOG / USE SCHEMA (plus
SELECT or BROWSE) to see tables.

Corporate networks (TLS inspection)
Many company networks inspect TLS traffic and re-sign it with the company's own root certificate. Everything
then fails with errors like unable to get local issuer certificate or self-signed certificate in certificate chain until that root certificate is trusted.
Run Databricks SQL: Set Up Corporate Certificate and pick one of:
- Use my company's certificate file: the
.crt, .pem or .cer file you already use with your scripts.
PEM and DER both work, and so does a bundle of several certificates.
- Certificates installed on this computer: the Windows certificate store, macOS keychain or Linux system
store, where IT usually installs corporate roots. This is on by default.
The certificate is used for every connection the extension makes: Databricks REST calls and Microsoft sign-in
for the Azure service principal mode. Calls still go through VS Code's proxy settings (http.proxy).
Show Diagnostics shows the certificate chain each server presents, for example
adb-123.azuredatabricks.net ← Zscaler Intermediate (top issued by "Zscaler Root CA").
The Azure CLI and the Databricks CLI make their own HTTPS calls and use their own certificate settings:
REQUESTS_CA_BUNDLE for the Azure CLI, and the OS certificate store (or SSL_CERT_FILE on Linux) for the
Databricks CLI.
Copilot and other AI agents (MCP)
On VS Code 1.101+ the extension registers an MCP server with VS Code itself, so Copilot finds it with no
mcp.json editing. The server runs inside the extension on 127.0.0.1, on a random port, protected by a
random per-session bearer token that only VS Code receives.
Tools: list_connections, get_active_connection, list_catalogs, list_schemas, list_tables,
search_tables (by LIKE pattern across a catalog), describe_table, run_query, explain_query. The
catalog tools use the Unity Catalog API and never start the warehouse.
Safety rules:
- AI can use only the connections in
dbsqlWorkbench.mcp.allowedConnections (empty by default). The Add
Connection form has a checkbox for it, and when Copilot asks for a connection that is not allowed you get a
prompt. Keep production connections out unless you really need them.
- One statement per call, with a timeout, a row limit and a result size cap.
- Databricks SQL has no read-only transactions, so the extension checks each statement before it runs:
only statements that start with
SELECT, WITH, SHOW, DESCRIBE, EXPLAIN, VALUES, TABLE or FROM
and contain no INSERT, UPDATE, DELETE, MERGE, CREATE, DROP, ALTER, GRANT and similar run
directly. Everything else, and calls such as http_request(...), is a write: it needs
dbsqlWorkbench.mcp.allowWrites and your confirmation in a dialog that shows the full SQL, every time.
For the strongest protection, give AI a connection whose identity can only read.
- Every AI query is logged in the Databricks SQL output channel, marked
[MCP].
- Tool results never contain tokens or secrets.
Commands
All commands are under Databricks SQL: in the Command Palette.
| Command |
What it does |
| Add / Edit / Delete Connection |
Manage saved connections (form with Browse and Test Connection) |
| Sign In / Sign Out |
Sign a connection in or out for this VS Code session |
| Choose Connection for This File |
Pick the connection, catalog and schema the active SQL file runs on |
| Set Catalog and Schema |
Change only the catalog and schema |
| Choose Warehouse / Start Warehouse |
Pick the connection's SQL warehouse, or start it ahead of time |
| New SQL File |
Open a SQL file for the selected connection, catalog or schema |
| Run Statement or Selection / Run All |
Ctrl+Enter / Ctrl+Shift+Enter |
| Cancel Query |
Cancel the running statement on the warehouse |
| Copy Last Result as CSV |
The rows of the last result |
| Search / Clear Query History |
Find a past query, or delete them all |
| Show Diagnostics |
Step-by-step check of a connection |
| Set Up Corporate Certificate |
Trust your company's root certificate |
| Manage AI Access to Connections / Show MCP Status |
Control and inspect what Copilot can use |
Settings
| Setting |
Default |
|
dbsqlWorkbench.maxRows |
1000 |
Rows fetched and shown per statement |
dbsqlWorkbench.queryTimeoutSeconds |
0 |
Cancel editor queries after this many seconds (0 = no limit) |
dbsqlWorkbench.resultsView |
grid |
grid or outputChannel |
dbsqlWorkbench.runWithoutSelection |
statement |
What Ctrl+Enter runs with nothing selected: statement or file |
dbsqlWorkbench.codeLens |
true |
Run links and the file's connection on the first line |
dbsqlWorkbench.autocomplete |
true |
Autocomplete and hover from Unity Catalog |
dbsqlWorkbench.history.maxEntries |
500 |
Queries kept in the history (0 turns it off) |
dbsqlWorkbench.databricksCliPath |
databricks |
Path to the Databricks CLI |
dbsqlWorkbench.tls.caFile |
|
Your company's root certificate file |
dbsqlWorkbench.tls.useSystemCertificates |
true |
Also trust the certificates installed on this computer |
dbsqlWorkbench.mcp.enabled |
true |
Offer the AI tools to Copilot and MCP clients |
dbsqlWorkbench.mcp.allowedConnections |
[] |
Connections AI may use (* for all) |
dbsqlWorkbench.mcp.allowWrites |
false |
Let AI run writes, each confirmed by you |
dbsqlWorkbench.mcp.maxRows / queryTimeoutSeconds / maxResultChars |
200 / 120 / 60000 |
Limits for AI queries |
Settings that could weaken security (mcp.allowWrites, mcp.allowedConnections) can only be set in your user
settings, not by a workspace's .vscode/settings.json.
Fixing common errors
Run Databricks SQL: Show Diagnostics first.
| You see |
What it usually means |
invalid_client, AADSTS7000215 |
Wrong secret, or an Azure secret used in the Databricks service principal mode (or the other way round) |
AADSTS7000222 |
The Azure client secret has expired |
| Consent / "admin approval" |
Your tenant needs admin consent for VS Code; use My Azure CLI login |
self-signed certificate, unable to get local issuer certificate |
Your network inspects TLS: run Set Up Corporate Certificate |
PERMISSION_DENIED on a statement |
The identity needs CAN USE on the SQL warehouse |
Empty catalogs or PERMISSION_DENIED in the sidebar |
It needs USE CATALOG / USE SCHEMA |
TABLE_OR_VIEW_NOT_FOUND |
Check the file's catalog and schema (first line), or use catalog.schema.table |
| A query "hangs" at first |
The warehouse is starting; the status bar shows "waiting for the warehouse" |
Secrets and tokens are never written to settings or logs. Everything printed to the output channel goes through
a redaction filter.
Contributing
Issues and pull requests are welcome.
npm install
npm run build # bundle to dist/extension.js (esbuild)
npm test # type-check tests and run them (the HTTPS tests need openssl)
npm run package # type-check, bundle and create the .vsix
Press F5 in VS Code with this folder open to run the extension in a development host.
test/fakeWorkspace.ts is a fake Databricks workspace (OAuth, SCIM, SQL warehouses, the Statement Execution API
and Unity Catalog) used by the integration tests. It follows the documented request and response shapes.
To release a new version: update version in package.json, add a ## <version> section to CHANGELOG.md,
commit, and push a matching tag (git tag v0.2.0 && git push origin v0.2.0). The
Publish workflow runs the tests, publishes to the Marketplace with Trusted
Publishing (no token stored anywhere) and creates the GitHub release with the same .vsix.
License
MIT