@clickhouse/client
Advanced tools
Changelog
1.10.0 (Common, Node.js, Web)
Added support for JWT authentication (ClickHouse Cloud feature) in both Node.js and Web API packages. JWT token can be set via access_token
client configuration option.
const client = createClient({
// ...
access_token: '<JWT access token>',
})
Access token can also be configured via the URL params, e.g., https://host:port?access_token=...
.
It is also possible to override the access token for a particular request (see BaseQueryParams.auth
for more details).
NB: do not mix access token and username/password credentials in the configuration; the client will throw an error if both are set.
Changelog
1.9.0 (Common, Node.js, Web)
input_format_json_throw_on_bad_escape_sequence
to the ClickhouseSettings
type. (#355, @emmanuel-bonin)TupleParam
wrapper class, allowing tuples to be properly used as query parameters. Added support for JS Map as a query parameter. (#359)2**29 - 24
bytes. (#357)Changelog
1.8.0 (Common, Node.js, Web)
Changelog
1.7.0 (Common, Node.js, Web)
Added JSONEachRowWithProgress
format support, ProgressRow
interface, and isProgressRow
type guard. See this Node.js example for more details. It should work similarly with the Web version.
(Experimental) Exposed the parseColumnType
function that takes a string representation of a ClickHouse type (e.g., FixedString(16)
, Nullable(Int32)
, etc.) and returns an AST-like object that represents the type. For example:
for (const type of [
'Int32',
'Array(Nullable(String))',
`Map(Int32, DateTime64(9, 'UTC'))`,
]) {
console.log(`##### Source ClickHouse type: ${type}`)
console.log(parseColumnType(type))
}
The above code will output:
##### Source ClickHouse type: Int32
{ type: 'Simple', columnType: 'Int32', sourceType: 'Int32' }
##### Source ClickHouse type: Array(Nullable(String))
{
type: 'Array',
value: {
type: 'Nullable',
sourceType: 'Nullable(String)',
value: { type: 'Simple', columnType: 'String', sourceType: 'String' }
},
dimensions: 1,
sourceType: 'Array(Nullable(String))'
}
##### Source ClickHouse type: Map(Int32, DateTime64(9, 'UTC'))
{
type: 'Map',
key: { type: 'Simple', columnType: 'Int32', sourceType: 'Int32' },
value: {
type: 'DateTime64',
timezone: 'UTC',
precision: 9,
sourceType: "DateTime64(9, 'UTC')"
},
sourceType: "Map(Int32, DateTime64(9, 'UTC'))"
}
While the original intention was to use this function internally for Native
/RowBinaryWithNamesAndTypes
data formats headers parsing, it can be useful for other purposes as well (e.g., interfaces generation, or custom JSON serializers).
NB: currently unsupported source types to parse:
Changelog
1.6.0 (Common, Node.js, Web)
real_time_microseconds
field to the ClickHouseSummary
interface (see https://github.com/ClickHouse/ClickHouse/pull/69032)ResultSet.json
if the response data was not in fact a valid JSON. (#311)Changelog
1.4.1 (Node.js, Web)
ClickHouseClient
is now exported as a value from @clickhouse/client
and @clickhouse/client-web
packages, allowing for better integration in dependency injection frameworks that rely on IoC (e.g., Nest.js, tsyringe) (@mathieu-bour, #292).