ClickHouse Action Block
What it does: Runs SQL against a ClickHouse database over its HTTP interface — analytical queries, bulk inserts, and schema management — and returns structured rows to your workflow.
⚡
In simple terms: Point the block at your ClickHouse Cloud or self-hosted endpoint, write SQL, and get back rows, columns, and a rowCount you can feed into an LLM, a report, or another block.
Credentials
| Field | Required | Description |
|---|---|---|
| HTTP URL | Yes | HTTP interface endpoint, e.g. https://abc.us-east-1.aws.clickhouse.cloud:8443. The protocol defaults to https if you omit it. Self-hosted instances usually listen on port 8123. |
| Username | No | ClickHouse user (often default). Sent as the X-ClickHouse-User header. |
| Password | No | Sent as the X-ClickHouse-Key header. |
| Default database | No | Used whenever a block does not set its own Database field. |
In ClickHouse Cloud, find these under your service → Connect → HTTPS.
Actions
| Action | What it does | Output |
|---|---|---|
| Run Query | Executes any SQL statement with optional server-side parameters | { rows, columns, rowCount, statistics, raw } |
| Insert Rows | Inserts a JSON array of objects via INSERT INTO … FORMAT JSONEachRow | { inserted, table, raw } |
| List Databases | SHOW DATABASES | { rows, columns, rowCount } |
| List Tables | SHOW TABLES FROM <database> | { rows, columns, rowCount } |
| Describe Table | DESCRIBE TABLE <database>.<table> | { rows, columns, rowCount } |
| Create Table | Runs your raw DDL, or builds a CREATE TABLE from table + schema fields + engine + order by | { created, statement, raw } |
| Truncate Table | TRUNCATE TABLE IF EXISTS — requires confirmation | { table, statement, raw } |
| Drop Table | DROP TABLE IF EXISTS — requires confirmation | { table, statement, raw } |
| Ping | GET /ping to verify connectivity | { ok, status, response } |
Fields
| Field | Used by | Description |
|---|---|---|
query | Run Query | The SQL statement. |
params | Run Query | JSON object of parameters, sent as param_<name>. |
database | most actions | Database name — falls back to the credential's default. |
table | Insert / Describe / Create / Truncate / Drop | Table name, optionally database.table. |
rows | Insert Rows | JSON array of row objects. |
ddl | Create Table | Raw CREATE TABLE statement (takes precedence). |
schemaFields | Create Table | {"id":"UInt64","name":"String"} or [{ "name": "id", "type": "UInt64" }]. |
engine | Create Table | Table engine, defaults to MergeTree. |
orderBy | Create Table | ORDER BY expression, defaults to tuple(). |
confirm | Truncate / Drop | Must exactly match the table name. |
maxRows | Run Query | Caps the result set (max_result_rows). |
format | Run Query | ClickHouse output format, defaults to JSON. |
Query parameters
ClickHouse binds parameters server-side, which keeps interpolated workflow variables out of the SQL text:
SELECT event, count() AS total
FROM events
WHERE user_id = {uid:UInt64} AND event = {name:String}
GROUP BY eventWith Params:
{ "uid": "42", "name": "purchase" }Tips
- Database and table names are validated: only letters, digits and underscores (plus one dot for
database.table) are accepted.queryandddlare intentionally raw — they are your own SQL. - Truncate and Drop refuse to run unless Confirm matches the table name exactly.
- Setting Format to something other than
JSON(e.g.CSV,TSV) returns the response body inrawinstead of parsedrows. - Use Max Rows on exploratory queries so a wide
SELECT *cannot flood the workflow output.