ClickHouse Handler
Overview
Databend is ClickHouse wire protocol-compatible, allow you to connect to Databend server with Clickhouse client, make it easier for users/developers to use Databend.
ClickHouse REST API
tip
Databend ClickHouse HTTP handler is a simplified version of the implementation, it only providers:
- Heath check
- Insert with JSONEachRow format
Health Check
query=SELECT 1
curl '127.0.0.1:8000/clickhouse/?query=select%201'
Response
1
Insert with JSONEachRow(ndjson)
note
Databend ClickHouse HTTP handler only supports put ndjson(JSONEachRow in ClickHouse) format values.
ndjson is a newline delimited JSON format:
- Line Separator is '\n'
- Each Line is a Valid JSON Value
For example, we have a table:
table t1
CREATE TABLE t1(a TINYINT UNSIGNED);
Insert into t1
:
insert into t1 format JSONEachRow
echo -e '{"a": 1}\n{"a": 2}' | curl '127.0.0.1:8000/clickhouse/?query=INSERT%20INTO%20t1%20FORMAT%20JSONEachRow' --data-binary @-
Insert with Authentication
Use HTTP basic authentication:
echo -e '{"a": 1}\n{"a": 2}' | curl 'user:password@127.0.0.1:8000/clickhouse/?query=INSERT%20INTO%20t1%20FORMAT%20JSONEachRow' --data-binary @-
Compression
Databend ClickHouse HTTP handler supports the following compression methods:
- BR
- DEFLATE
- GZIP