Install SQLTools in VS Code and add a ClickHouse connection string to run ClickHouse queries directly inside the editor.
Running ClickHouse inside VS Code lets you keep coding, data exploration, and version control in one place. You gain IntelliSense, snippets, and Git history without switching tools.
Install SQLTools (Editor: SQLTools) and SQLTools ClickHouse Driver. Both are available in the VS Code Marketplace.
Open the VS Code Command Palette → "SQLTools: Add new connection" → choose ClickHouse. Provide a name, host, port, username, password, and default database.Save to settings.json
.
{ "sqltools.connections": [ { "name": "Local ClickHouse", "driver": "ClickHouse", "server": "127.0.0.1", "port": 9000, "database": "ecommerce", "username": "default", "password": "mypassword", "readTimeout": 30000, "ssl": false } ]}
Create a .sql
file, select the connection in the Status Bar, highlight a statement, and press Ctrl + Shift + E.Results appear in an inline grid.
Create user snippets for repetitive tasks (e.g., select_top_customers
) to reduce typing.
Store your .sql
files in Git to track history alongside application code.
If connection fails, verify the ClickHouse port (default 9000) is open and not blocked by a firewall. Check that the SQLTools ClickHouse driver matches your ClickHouse server version.
.
Yes. Separate statements with semicolons, highlight them, and run. SQLTools executes each statement in order.
Yes. Set "ssl": true
and provide certificates if your ClickHouse server is configured for TLS.
Edit "database": "your_db"
in the connection JSON or run USE your_db;
in the query window.