Repository navigation
Migration Notes
query()now sends itsformatto the server as thedefault_formatsetting, instead of appendingFORMAT <format>to the SQL (see Improvements below). No code change is required, but check the following:- The query text recorded in
system.query_log, in logs and in traces no longer ends withFORMAT <format>. Adjust anything that matches on that suffix. - A
FORMATclause in the query itself is no longer a syntax error: the server uses it, and if it differs from theformatoption,query()throws an error that names both formats. With atracerconfigured, that error is recorded on theclickhouse.query.streamspan (#1103). Remove the clause, or useexec()if you need full control over the SQL. - A user whose profile locks
default_formatwith a<constraints>entry (possible on ClickHouse 26.x) fails everyquery()withSETTING_CONSTRAINT_VIOLATION. Allow changingdefault_formatfor that user. (#1085)
- The query text recorded in
Improvements
-
query()now sends the query as written and passes itsformatto the server as thedefault_formatsetting, instead of appendingFORMAT <format>to the SQL. This matches the Go, Rust and Java clients, and fixes queries that failed because of the appended clause:- a trailing semicolon followed by a comment, such as
SELECT 1; -- note, no longer fails withMulti-statements are not allowed(#973); FORMATis no longer placed after a trailingSETTINGSclause, which some older servers rejected (#970);- the short
SHOW ROW POLICIESsyntax works (#759).
The
formatoption overrides adefault_formatset inclickhouse_settings. AnX-ClickHouse-Formatrequest header set viahttp_headers(on the client or on the call) is not sent byquery(), as the server would prefer it overdefault_format; the other methods still send it. (#1085) - a trailing semicolon followed by a comment, such as
-
command()andexec()now also send the query as written, without removing trailing semicolons, as the server accepts them. The one exception isexec()withvalues: the server reads the data right after the statement and rejects a;before it, so trailing semicolons are still removed there. (#1085) -
When the server reports an error in a JSON output format (with
http_write_exception_in_output_formatenabled, the error that occurs while it writes the result comes back as{"exception": "..."}),ClickHouseError.messageno longer keeps the JSON escaping, for example\"instead of". (#1085)
Bug fixes
- (Web only)
ResultSet.close()now ends theclickhouse.query.streamtracing span when cancelling the response stream rejects (for example after a connection reset), instead of leaving the span open. (#1103)