Clickhouse CLI result
When performing a query using the clickhouse-client command line interface and setting the format as JSON, we not only obtain the result but also statistics.
Command
clickhouse-client --password=test --user=default --format=JSON --query="select 1 + 1"
Result
{
"meta":
[
{
"name": "plus(1, 1)",
"type": "UInt16"
}
],
"data":
[
{
"plus(1, 1)": 2
}
],
"rows": 1,
"statistics":
{
"elapsed": 0.001043427,
"rows_read": 1,
"bytes_read": 1
}
}
I tried using the official ClickHouse library in Golang (github.com/ClickHouse/clickhouse-go/v2) but was unsuccessful in achieving the desired result.
If anyone has successfully obtained a JSON response using the Golang library, I would appreciate any insights or solutions shared.