@clickhouse/client
Official ClickHouse client for Node.js with streaming inserts, query result formats, and sessions.
Official Documentation ↗v1. Check the official docs for the latest API surface.Installation
npm install @clickhouse/clientMethods
No methods match this filter.
The ClickHouse client sends SQL over HTTP and can stream both query results and insert payloads.
Key Features
- HTTP-based queries with result format control
- Streaming inserts with JSONEachRow
- Parameterized queries to prevent injection
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://clickhouse.com/docs/integrations/javascript · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:55.525Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- This could potentially be useful for event listeners and similar scenarios, but the error handling might be non-trivial with a lot of edge cases on the client side. (https://clickhouse.com/docs/integrations/javascript)
- If the server is unreachable, the underlying error is included in the result as well. (https://clickhouse.com/docs/integrations/javascript)
- Keep an eye on potential “Socket hang-up” errors, which will indicate that the server closes the connections before the client does so, and lower the value until the errors disappear. (https://clickhouse.com/docs/integrations/javascript)
Security notes
Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://clickhouse.com/docs/integrations/javascript · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:55.525Z.
- If you have a ClickHouse version older than 23.3, please refer to ClickHouse security policy and consider upgrading. (https://clickhouse.com/docs/integrations/javascript)
- USERNAME and PASSWORD Out of the box, the username is default . (https://clickhouse.com/docs/integrations/javascript)
- It assumes url (including protocol and port) and password values are specified via environment variables, and default user is used. (https://clickhouse.com/docs/integrations/javascript)
FAQ
- Why is my query failing with a format error?
- ClickHouse needs an output format for HTTP responses. The client sets one automatically, but a custom query string must include a FORMAT clause.
- How do I parameterize safely?
- Use the query_params option and reference values as {name:Type}; do not concatenate strings into SQL.
- Can I stream large inserts?
- Yes. Pass a Readable stream of JSONEachRow lines to values so the client does not buffer the entire batch in memory.
Report a problem with this API docOpens a pre-filled issue on GitHub.