ClickHouse Client
$ clickhouse-client Official High Riskclickhouse-client connects to ClickHouse servers (or local ClickHouse) over native TCP protocol for analytical SQL queries and bulk ingestion. Supports --query non-interactive execution, --format JSON / JSONEachRow, and server-enforced --readonly=1 setting.
brew install clickhouse clickhouse-client --readonly=1 --format JSONEachRow --query "..." streams massive OLAP aggregations directly with native compression and zero MCP serialization bottleneck.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports --query, --format JSON / JSONEachRow / TabSeparated, --readonly=1, and clean non-TTY execution.
- Supports
--query,--format JSON,--format JSONEachRow, and--readonly=1
--readonly=1 instructs the server to reject all writes and DDL (INSERT, ALTER, DROP), providing strong query safety.
- Server-enforced
--readonly=1setting rejects writes and DDL
Monolithic binary (shared with clickhouse-local/server) for macOS and Linux; lacks native Windows support.
- Large monolithic binary limited to macOS and Linux
Blazing fast columnar OLAP querying and rich native output formats (JSON, JSONEachRow, Parquet).
- Native binary protocol +
JSONEachRow/Parquetformat support
Official ClickHouse/ClickHouse client maintained by ClickHouse under Apache-2.0.
- Official
ClickHouse/ClickHouserepository
Detailed CLI and output-format docs at clickhouse.com/docs/en/interfaces/cli.
- Official docs at clickhouse.com/docs/en/interfaces/cli
Security, Auth & Guardrails
Connection settings in ~/.clickhouse-client/config.xml or via --host, --user, and CLICKHOUSE_PASSWORD env var.
100% free and Apache-2.0 open-source; ClickHouse Cloud instances incur hosted compute/storage billing.
# clickhouse-client Agent Rules - Always pass `--query "<sql>"`, `--format JSON` (or `JSONEachRow`), and `--readonly=1` for read queries. - Always constrain `WHERE` time partitions and `LIMIT` to avoid full-table scans. - NEVER run `DROP TABLE`, `TRUNCATE`, or `ALTER TABLE ... DELETE` autonomously.
Agent-Ready Command Recipes
Safe Read-Only Queries
clickhouse-client --readonly=1 --format JSON --query "DESCRIBE TABLE default.events"
Reads column types and codecs in read-only mode and outputs JSON.
clickhouse-client --readonly=1 --format JSONEachRow --query "SELECT event_type, count() AS n FROM default.events GROUP BY 1 ORDER BY 2 DESC LIMIT 10"
Enforces readonly=1 and emits compact newline-delimited JSON rows.
Strengths for Agents
- +
--readonly=1gives true server-side protection against writes and DDL. - +
--format JSONand--format JSONEachRowoutput clean machine-readable results. - + Also bundles
clickhouse-localfor zero-server analytics over local files.
Caveats & Pitfalls
- ! Binary download is large because
clickhousebundles server, client, and local modes. - ! No native Windows binary (requires WSL or Docker).