Skip to main content
Technical Preview

Overview

A client-mode connector for the ClickHouse HTTP interface that streams MQTT telemetry into ClickHouse tables and runs SQL from MQTT. It works with self-hosted ClickHouse and ClickHouse Cloud. Default BASE_ADDRESS is https://YOUR_CLICKHOUSE_HOST:8443 (ClickHouse Cloud and TLS). For a self-hosted server on plain HTTP, use http://YOUR_CLICKHOUSE_HOST:8123 and set USE_SSL "false". Topics use data/clickhouse/<object>/<verb>.
GET is read-only. ClickHouse rejects CREATE, INSERT, or DROP sent with GET (Cannot execute query in readonly mode). Send those through the ExecSql event, which uses POST.

Auth

The connector sends HTTP Basic auth from WITH USERNAME and WITH PASSWORD in REST_API_CONFIG. Store the password as a broker secret named CLICKHOUSE_PASSWORD and read it with GET SECRET; never commit it. ClickHouse Cloud users are usually default with the password shown when the service is created. ClickHouse also accepts the X-ClickHouse-User and X-ClickHouse-Key headers if you prefer them.

Basic Syntax

Example MQTT payloads

Insert a row (topic data/clickhouse/rows/insert). The payload is the JSON row. The table field picks the target table and is skipped as a column because the endpoint sets input_format_skip_unknown_fields=1:
Create the table first, for example through ExecSql:
Run SQL (topic data/clickhouse/sql/exec). Publish the raw SQL text, not JSON:
The response topic receives ClickHouse’s JSON, for example {"meta":[…],"data":[{"site":"porto","avg_value":21.5}],"rows":1,…}. DDL and INSERT … VALUES return an empty body with HTTP 200. Read-only query (topic data/clickhouse/query/json). URL-encode the SQL before publishing:
Health (topic data/clickhouse/ping) takes any payload, such as {}.

Testing

The factory smoke ran against a local ClickHouse 26.10 server with a password-protected user. GET /ping returned 200, CREATE TABLE through a POST SQL body returned 200, a JSONEachRow async insert from a JSON payload with an extra table field returned 200, and the rows came back through POST … FORMAT JSON and the read-only GET query (both 200). A wrong password returned 403 and malformed JSON returned 400, and both error bodies reach the response topic.
Last modified on October 21, 2026