@clickhouse/client-common
Advanced tools
Changelog
0.2.9 (Common, Node.js, Web)
const client = createClient({
additional_headers: {
'X-ClickHouse-User': 'clickhouse_user',
'X-ClickHouse-Key': 'clickhouse_password',
},
})
Changelog
0.2.8 (Common, Node.js, Web)
import { createClient } from '@clickhouse/client-web'
const client = createClient({ keep_alive: { enabled: true } })
// Generated query: INSERT INTO mytable (message) FORMAT JSONEachRow
await client.insert({
table: 'mytable',
format: 'JSONEachRow',
values: [{ message: 'foo' }],
columns: ['message'],
})
// Generated query: INSERT INTO mytable (* EXCEPT (message)) FORMAT JSONEachRow
await client.insert({
table: 'mytable',
format: 'JSONEachRow',
values: [{ id: 42 }],
columns: { except: ['message'] },
})
See also the new examples:
Changelog
0.2.7 (Common, Node.js, Web)
X-ClickHouse-Summary
response header is now parsed when working with insert
/exec
/command
methods.
See the related test for more details.
NB: it is guaranteed to be correct only for non-streaming scenarios.
Web version does not currently support this due to CORS limitations. (#210)async_insert
, especially in the Cloudflare Workers context.Changelog
0.2.6 (Common, Node.js)
Changelog
0.2.2 (Common, Node.js & Web)
default_format
setting, which allows to perform exec
calls without FORMAT
clause.Changelog
0.2.1 (Common, Node.js & Web)
Date objects in query parameters are now serialized as time-zone-agnostic Unix timestamps (NNNNNNNNNN[.NNN], optionally with millisecond-precision) instead of datetime strings without time zones (YYYY-MM-DD HH:MM:SS[.MMM]). This means the server will receive the same absolute timestamp the client sent even if the client's time zone and the database server's time zone differ. Previously, if the server used one time zone and the client used another, Date objects would be encoded in the client's time zone and decoded in the server's time zone and create a mismatch.
For instance, if the server used UTC (GMT) and the client used PST (GMT-8), a Date object for "2023-01-01 13:00:00 PST" would be encoded as "2023-01-01 13:00:00.000" and decoded as "2023-01-01 13:00:00 UTC" (which is 2023-01-01 05:00:00 PST). Now, "2023-01-01 13:00:00 PST" is encoded as "1672606800000" and decoded as "2023-01-01 21:00:00 UTC", the same time the client sent.
Changelog
0.2.0 (web platform support)
Introduces web client (using native fetch and WebStream APIs) without Node.js modules in the common interfaces. No polyfills are required.
Web client is confirmed to work with Chrome/Firefox/CloudFlare workers.
It is now possible to implement new custom connections on top of @clickhouse/client-common
.
The client was refactored into three packages:
@clickhouse/client-common
: all possible platform-independent code, types and interfaces@clickhouse/client-web
: new web (or non-Node.js env) connection, uses native fetch.@clickhouse/client
: Node.js connection as it was before.