Skip to content

v1.8.0

Latest

Choose a tag to compare

@joe-clickhouse joe-clickhouse released this 03 Sep 00:01
eeb8530

clickhouse-connect v1.8.0

This release introduces an experimental Rust codec for faster ClickHouse Native query decoding and insert encoding. It also expands ClickHouse type support and includes several SQLAlchemy, Alembic, Native format, and packaging fixes.

The Rust codec is opt in. The existing Python and Cython codec is still the default.

Highlights

Experimental Rust codec

The new native_codec option covers query, query_np, query_df, their streaming variants, and inserts including insert_df.

client = clickhouse_connect.get_client(
    host="localhost",
    native_codec="rust",
)

native_codec="rust" falls back to Python for unsupported paths. Use native_codec="rust_strict" while evaluating or benchmarking so unsupported paths raise instead.

The Rust codec is currently most useful for:

  • Large DataFrame results containing String, LowCardinality, Array, Map, JSON, Decimal, and UUID columns
  • Large row and column block streams
  • Concurrent query workloads
  • Bulk inserts

Small results and flat numeric tables may see less benefit at the moment. Buffered query() calls on very wide or numeric results may also currently be slower. Benchmark your own workload before adopting the codec.

For evaluation, install the Rust codec with PyArrow:

pip install --upgrade "clickhouse-connect[rust,arrow]"

Note that PyArrow is required for Rust NumPy and Pandas output paths in 1.8. Applications using standard Python rows, block streams, and inserts can use the smaller installation:

pip install --upgrade "clickhouse-connect[rust]"

The compiled codec is published separately as clickhouse-connect-core 0.2.0. Existing installations do not install it automatically. The codec, packaging, and dependency set are currently experimental.

Geometry and Native types

  • Added Native query and insert support for Geometry and MultiPoint in both codecs. Inserting MultiPoint requires ClickHouse 26.8 or later. #1018
  • Added support for all ClickHouse Interval* types.
  • Expanded Time64 parsing, reflection, query, and insert support across server-valid precisions.
  • Fixed empty Tuple() Native serialization, including nested and nullable forms. #971
  • Fixed Variant member ordering that could write Native insert data under the wrong member type.
  • Improved parsing for generic Enum definitions, Dynamic arguments, and quoted type names.

SQLAlchemy and Alembic

  • Added typed-path configuration and canonical reflection for ClickHouse JSON columns. #981
  • Added standalone Variant reflection. #989
  • Fixed Alembic rendering for Nested, named Tuple, AggregateFunction, and SimpleAggregateFunction columns. #988 #992
  • Fixed dialect-aware DDL compilation for TypeDecorator and with_variant(). #984
  • SQLAlchemy and Alembic now connect and reflect correctly with native_codec="rust_strict". #1019
  • The Alembic extra now requires Alembic 1.18 or later. #983

Reliability and packaging

  • Rust streams now honor show_clickhouse_errors.
  • Abandoned Rust streams now release their response, socket, buffered data, and read-ahead thread promptly.
  • IPv6 host literals are bracketed correctly for sync and async connections. #998
  • Source builds now provide explicit C-extension modes through CLICKHOUSE_CONNECT_REQUIRE_C and CLICKHOUSE_CONNECT_SKIP_CYTHON. #994

Install the standard Python driver with:

pip install --upgrade clickhouse-connect

Please report Rust codec feedback and compatibility issues at:
https://github.com/ClickHouse/clickhouse-connect/issues

Full Changelog: v1.7.2...v1.8.0