npm / @clickhouse/client
@clickhouse/client
What changed in @clickhouse/client 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
16 breaking1 security7 deprecations23 new APIs and options2 performance13 behavior and defaults11 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@clickhouse/client 173 changes
Breaking changes 16
For errors returned in JSON output formats, ClickHouseError.message no longer retains JSON escaping.
exec() sends the query as written without removing trailing semicolons, except when used with values, where trailing semicolons are still removed.
query() sends SQL as written and passes format as the server's default_format setting instead of appending a FORMAT clause. The format option overrides clickhouse_settings.default_format; query() does not send X-ClickHouse-Format headers.
A standalone, dependency-free package parses ClickHouse data-type strings and emits a JSON AST that mirrors the server's data-type AST.
The Node.js engine floor for @clickhouse/client and @clickhouse/datatype-parser is now >=20; Node.js 18.x is no longer supported.
The web client rejects the zstd codec when the client is created.
compress_requestanddecompress_responsechange from booleans to normalized codec objects or undefined, affecting direct users of the deprecated low-level package.The low-level function takes request and response codec values instead of boolean enable flags; the codec determines the emitted Content-Encoding and Accept-Encoding.
The low-level function takes a response codec object or undefined instead of a boolean.
Tracing follows OpenTelemetry database semantic conventions, updates span attributes and status behavior, and records response-side attributes and insert row counts.
The client now rejects responses with this header as parsed ClickHouseError instances, even when the HTTP status indicates success.
Now unescapes backslash sequences in enum names, returning decoded values such as a single quote instead of preserving the raw escape sequence.
Node.js and Web versions now uniformly export ClickHouseClient and ClickHouseClientConfigOptions types specific to each implementation; ClickHouseClient no longer exposes a Stream type parameter.
Response compression is disabled by default; explicitly enable it in client configuration to continue using it.
Adds http_headers as a direct replacement for additional_headers; its function is unchanged.
When using URL configuration, specify pathname as a separate configuration option because the URL path is otherwise considered the database.
Security 1
On Node.js, hardened stream consumption through a single consume() path that marks the result set as consumed in the appropriate branches, after format validation.
Deprecations 7
The package is deprecated and will no longer receive updates; import its former exports from @clickhouse/client or @clickhouse/client-web instead.
This function is deprecated and slated for removal in a future major version; use @clickhouse/datatype-parser's parseDataType instead.
This companion is deprecated and slated for removal in a future major version; use @clickhouse/datatype-parser's parseDataType instead.
The utility is deprecated because the client drains streams internally when needed; use client.command() instead.
The utility is deprecated because it is not intended for use outside the client implementation; use setTimeout directly or a utility library for additional features.
The additional_headers configuration parameter is deprecated in favor of http_headers. Using it logs a warning, but remains allowed for now.
The host configuration parameter is deprecated in favor of url. Using it logs a warning, but remains allowed for now.
New APIs and options 23
This type is now exported from the package root and can be imported from @clickhouse/client.
This client option defaults to false; when enabled, raw SQL is attached to spans and included in error-level logs for failed requests. Bound query_params values and credentials are never logged or traced.
A per-request query parameter field lets callers add application-level context to operation spans; caller attributes cannot override the client's db.*, server.*, or clickhouse.* attributes.
A package-neutral structural settings type is exported by the Node.js and Web clients, allowing shared settings helpers to type-check across both clients without casts.
An experimental additive option lets callers provide an externally built backend Connection-like object instead of using the default HTTP(S) factory; it is intended only for testing the chDB integration.
The Node.js client accepts an object specifying zstd compression;
truecontinues to select gzip. zstd requires Node.js >= 22.15.0.The Node.js client adds Brotli request compression using
{ codec: "br" }; its optionalqualitytunes compression and defaults to 4 for request bodies.A new exported type represents compression methods for direct users of the deprecated low-level package.
A new exported type represents request compression settings for direct users of the deprecated low-level package.
A new exported type represents response compression settings for direct users of the deprecated low-level package.
query() emits a child stream span that tracks ResultSet consumption separately from the HTTP request span, ending when the response is read, closed, or fails.
Sends query_params as multipart/form-data body parts instead of URL query-string entries, with SQL moved into a query part.
Automatically sends query_params as multipart/form-data when their URL-encoded length exceeds 4096 characters; smaller payloads remain in the URL.
Re-exported the type from @clickhouse/client and @clickhouse/client-web, so consumers can depend on either flavored package without importing @clickhouse/client-common.
The package ships Node-client-specific AI-agent coding and troubleshooting skills under node_modules/@clickhouse/client/skills/ and declares them for discovery tools.
Node.js clients can set max_response_headers_size to raise the per-request limit on response header size, avoiding HPE_HEADER_OVERFLOW for large accumulated progress headers.
Adds a Node.js-only option, defaulting to false, that destroys sockets idle longer than idle_socket_ttl immediately before each request.
Added http_status_code to query, insert, and exec commands.
Supports the Disposable API (
using), which automatically closes the client even if code throws, avoiding a try/finally cleanup block.BigInt values are now supported in query parameters.
Node.js callers can use the new parameter to manually handle request errors on the application side.
Custom parse and stringify functions can replace JSON.parse and JSON.stringify when working with JSON* family formats.
Adds URL configuration for most client parameters, including credentials, database, settings, and HTTP headers. URL values always overwrite hardcoded values and log a warning.
Performance 2
Log messages are constructed only when the configured log level is appropriate, which can improve performance when constructing ignored messages is expensive.
On Node.js, decoding entire row sets with streamable JSON formats is improved by using the same stream transformer as ResultSet.stream; streaming performance is unchanged.
Behavior and default changes 13
command() sends the query as written without removing trailing semicolons, which the server accepts.
The X-ClickHouse-Summary counters are now attached to the clickhouse.query span, making request-level metrics visible on the outer client span.
Every key in the summary header is recorded as a span attribute, including memory_usage and future server-side additions.
This span attribute is now recorded for non-streaming result consumption, including json() on single-document JSON formats.
The Node.js client accepts zstd response compression; decompression follows the server's actual Content-Encoding. zstd requires Node.js >= 22.15.0.
The Node.js client supports Brotli response decompression, following the server's Content-Encoding.
The client now warns when request_timeout exceeds 60 seconds and progress headers are not configured, helping users avoid socket hang-up errors on long-running queries.
When keep_alive is enabled, an ECONNRESET from the server now emits a WARN log suggesting that idle_socket_ttl be checked and including the server keep-alive timeout when available.
The client now passes rich context, including connection_id, query_id, request_id, and socket_id, to the logger's args parameter.
TRACE logging includes additional lifecycle messages and connection, request, and socket identifiers to help trace requests across a connection lifecycle.
The default log level is now ClickHouseLogLevel.WARN instead of ClickHouseLogLevel.OFF, providing visibility into potential issues by default.
The constructor now accepts a readonly array, permitting more usages.
TypeScript types for query results are inferred from the query format, including result shapes and which json or stream methods are allowed. Row types are also inferred for streams.
Fixes and other changes 11
In Node.js, ResultSet.close() no longer throws an uncaught error when the ResultSet wraps a stream without an error listener.
On Node.js, prevents an orphaned idle-socket timer from destroying a socket during a request that took it over after another queued request was aborted.
Date values nested in arrays, tuples, and maps are now emitted as quoted UTC date strings; nested Array(DateTime) and Array(DateTime64) bindings use day precision, while scalar binding is unchanged.
This type is now exported from the package root and can be imported from @clickhouse/client.
This type is now exported from the package root and can be imported from @clickhouse/client.
Re-exported from @clickhouse/client after being missed when the client-common public API was bundled into the client packages.
The Web ResultSet.stream() path now ends its stream span when the fetch stream aborts or the consumer cancels.
On Node.js, fixed a race on streamable result sets that could make json() throw “Stream has been already consumed” when the stream ended during internal checks.
Fixed ignore_error_response not being passed when using command.
Boolean values inside Array, Tuple, and Map query parameter types are formatted as TRUE/FALSE instead of 1/0 for ClickHouse type compatibility.
Exceptions occurring in the middle of the HTTP stream are now handled correctly. This requires ClickHouse 25.11 or later; previous ClickHouse versions are unaffected.