Additional options

The `get_client` `compress` parameter can also be set to a specific compression method, one of `lz4`, `zstd`, `br`, or `gzip`. That method will then be used for both inserts and query results (if supported by the ClickHouse server.) The required `zstd` and `lz4` compression libraries are now installed by default with ClickHouse Connect. If `br`/brotli is specified, the brotli library must be installed separately.

Note that the `raw*` client methods don't use the compression specified by the client configuration.

We also recommend against using `gzip` compression, as it is significantly slower than the alternatives for both compressing and decompressing data.

## HTTP proxy support[​](#http-proxy-support "Direct link to HTTP proxy support")

ClickHouse Connect adds basic HTTP proxy support using the `urllib3` library. It recognizes the standard `HTTP_PROXY` and `HTTPS_PROXY` environment variables. Note that using these environment variables will apply to any client created with the `clickhouse_connect.get_client` method. Alternatively, to configure per client, you can use the `http_proxy` or `https_proxy` arguments to the get\_client method. For details on the implementation of HTTP Proxy support, see the [urllib3](https://urllib3.readthedocs.io/en/stable/advanced-usage.html#http-and-https-proxies) documentation.

To use a SOCKS proxy, you can send a `urllib3` `SOCKSProxyManager` as the `pool_mgr` argument to `get_client`. Note that this will require installing the PySocks library either directly or using the `[socks]` option for the `urllib3` dependency.

## "Old" JSON data type[​](#old-json-data-type "Direct link to \"Old\" JSON data type")

The experimental `Object` (or `Object('json')`) data type is deprecated and should be avoided in a production environment. ClickHouse Connect continues to provide limited support for the data type for backward compatibility. Note that this support doesn't include queries that are expected to return "top level" or "parent" JSON values as dictionaries or the equivalent, and such queries will result in an exception.

## "New" Variant/Dynamic/JSON datatypes (experimental feature)[​](#new-variantdynamicjson-datatypes-experimental-feature "Direct link to \"New\" Variant/Dynamic/JSON datatypes (experimental feature)")

Beginning with the 0.8.0 release, `clickhouse-connect` provides experimental support for the new (also experimental) ClickHouse types Variant, Dynamic, and JSON.

### Usage notes[​](#usage-notes "Direct link to Usage notes")

- JSON data can be inserted as either a Python dictionary or a JSON string containing a JSON object `{}`. Other forms of JSON data aren't supported.
- Queries using subcolumns/paths for these types will return the type of the sub column.
- See the main ClickHouse [documentation](https://clickhouse.com/docs) for other usage notes.

### Known limitations[​](#known-limitations "Direct link to Known limitations")

- Each of these types must be enabled in the ClickHouse settings before using.
- The "new" JSON type is available starting with the ClickHouse 24.8 release
- Due to internal format changes, `clickhouse-connect` is only compatible with Variant types beginning with the ClickHouse 24.7 release
- Returned JSON objects will only return the `max_dynamic_paths` number of elements (which defaults to 1024). This will be fixed in a future release.
- Inserts into `Dynamic` columns will always be the String representation of the Python value. This will be fixed in a future release, once <https://github.com/ClickHouse/ClickHouse/issues/70395> has been fixed.
- The implementation for the new types hasn't been optimized in C code, so performance may be somewhat slower than for simpler, established data types.

- [Global settings](#global-settings)- [Compression](#compression)- [HTTP proxy support](#http-proxy-support)- ["Old" JSON data type](#old-json-data-type)- ["New" Variant/Dynamic/JSON datatypes (experimental feature)](#new-variantdynamicjson-datatypes-experimental-feature)
          - [Usage notes](#usage-notes)- [Known limitations](#known-limitations)

Was this page helpful?