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 fromWITH 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 (topicdata/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:
ExecSql:
data/clickhouse/sql/exec). Publish the raw SQL text, not JSON:
{"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:
data/clickhouse/ping) takes any payload, such as {}.

