Global settings
There are a handful of settings that control ClickHouse Connect behavior globally. They’re accessed from the top levelcommon package:
Configure client creation settings before creating clients. Settings such as generated session/query IDs and product identification are copied into client-specific state, so later global changes don’t update existing clients. Binding and insert settings are different.
naive_datetime_binding and dict_parameter_format are read when parameters are bound. naive_datetime_insert is read when a native insert column containing Python datetime objects or DateTime64 ISO strings is serialized. Changes to these settings affect existing clients. A reusable insert context uses the current naive_datetime_insert value for each insert.Compression
ClickHouse Connect supports lz4, zstd, brotli, gzip, and deflate response compression. Native inserts support lz4, zstd, brotli, and gzip. Compression trades CPU time for reduced network transfer. To receive compressed data, the ClickHouse serverenable_http_compression must be set to 1, or the user must have permission to change the setting on a “per query” basis.
Compression is controlled by the compress argument to get_client and get_async_client. The default, True, advertises every available response encoding and compresses Native insert blocks with lz4. Set compress=False to disable compression or pass one of "lz4", "zstd", "br", or "gzip" to request a specific method.
The raw client methods don’t use the client-level compress setting. raw_query and raw_stream return uncompressed data, and raw_insert takes its own compression argument describing compression already applied to the payload.
lz4 and zstd support are installed with ClickHouse Connect. On Python 3.14, zstd uses the standard library compression.zstd module. Python 3.10 through 3.13 use backports.zstd. A custom CPython 3.14+ interpreter built without zstd support still imports; zstd is dropped from the available methods and an error is raised only when zstd is explicitly requested. Brotli is optional and must be installed separately before using compress="br".
gzip is generally slower than lz4 or zstd for ClickHouse workloads.
HTTP proxy support
ClickHouse Connect recognizes the standardHTTP_PROXY and HTTPS_PROXY environment variables. These variables apply to every client in the process. To configure a proxy per client, pass http_proxy or https_proxy to get_client or get_async_client.
The synchronous client uses urllib3. To use a SOCKS proxy, install PySocks and pass a urllib3.contrib.socks.SOCKSProxyManager as the pool_mgr argument to get_client. pool_mgr is not supported by the async client.
Variant, Dynamic, and JSON data types
ClickHouse Connect supports the current ClickHouseVariant, Dynamic, and JSON types. The legacy Object('json') type was removed in clickhouse-connect 0.14 and is not supported.
Usage notes
Variantvalues are read as the matching Python type. Native inserts select a member based on the Python value type.- When multiple
Variantmembers map to the same Python type, wrap the value withclickhouse_connect.datatypes.dynamic.typed_variant(value, "TypeName")to select the member explicitly. - The
typedVariant read format returnsTypedVariant(value, type_name)objects and preserves the originating member type. Enable it withquery_formats={"Variant": "typed"}. Dynamicvalues are read as the matching Python type. Inserts are currently sent through the String representation.JSONvalues can be inserted as Python dictionaries or JSON object strings. The default read format returns dictionaries; use the"string"read format to return JSON strings.- Queries that select a
Variant,Dynamic, orJSONsubcolumn return the subcolumn’s concrete type.
Variant, Dynamic, and JSON type names use ClickHouse’s canonical argument order. Variant members are sorted and deduplicated by canonical type name, including when a Variant is nested inside another type. Dynamic type names keep the max_types argument, so a Dynamic(max_types=5) column reports as Dynamic(max_types=5) rather than Dynamic. JSON typed paths and skip rules are sorted, duplicate plain skip paths are removed, regular expression duplicates are preserved, and explicit default limits are omitted. A parsed JSON type exposes decoded rules through skip_paths and skip_regexps. Its skips attribute contains the corresponding canonical ClickHouse expressions.
Some values stored in the shared-data area of JSON or Dynamic columns use types that the client cannot yet decode. Those values are returned as raw bytes. These complex types also use the pure Python conversion path, so they can be slower than established scalar types.