github ClickHouse/clickhouse-connect v1.9.0

5 hours ago

clickhouse-connect v1.9.0

ClickHouse Connect 1.9.0 adds native async SQLAlchemy support, Rust codec performance improvements, and fixes across client cleanup, SQLAlchemy, Alembic, and inserts. It includes all changes from the three 1.9.0 release candidates.

Highlights

Features

  • Native async SQLAlchemy support for SQLAlchemy 2.0.44+. Use clickhousedb+async:// with create_async_engine() for buffered Core and ORM execution, DDL, reflection, and Alembic migrations through run_sync(). Use the native AsyncClient for streaming and bulk inserts. #576
  • SQLAlchemy multi-row Insert.values() supports dictionaries, tuples, and SQL expressions, including Pandas to_sql(method="multi"). #1024
  • Opt-in Native Map pairs reads preserve duplicate keys and the order returned by the server. Dictionary output remains the default, and inserts still require dictionaries. #949

Performance

  • Rust codec responses that fit in one chunk avoid starting a read-ahead thread.
  • Rust codec pandas StringDtype results use Arrow buffers directly without first creating Python strings.
  • Synchronous HTTP connections use operating-system socket buffer sizing for large uploads. #1044

Bug fixes

  • Improved async cancellation, initialization, connection disposal, token-provider cleanup, and pool timeout handling.
  • Rust read-ahead threads explicitly close their source iterators, so early cleanup no longer depends on prompt garbage collection.
  • Arrow inserts correctly quote table and database identifiers on both clients. #1014
  • Comments, quoted identifiers, and escaped strings containing LIMIT 0 no longer cause query results to be discarded. Metadata probes that unexpectedly return rows raise InternalError without replaying the query; use raw_query() for those queries. #925
  • Fixed SQLAlchemy DateTime64 precision, Decimal arithmetic, table-engine reflection, Alembic version-table handling, and timezone-aware Date/Date32 inserts.

Compatibility

  • Parameterized DB-API executemany() preserves SQL expressions and sends one request per parameter set. Earlier writes remain committed if a later request fails. Use Client.insert() for Native bulk throughput.
  • SQLAlchemy DateTime64 declarations must match the server schema.
  • Package metadata now uses PEP 639 license fields. Building from source requires setuptools>=77.0.3. #996

Installation

pip install clickhouse-connect

For async SQLAlchemy:

pip install "clickhouse-connect[sqlalchemy-async]"

See the SQLAlchemy guide and full changelog, including the RC1, RC2, and RC3 sections.

Don't miss a new clickhouse-connect release

NewReleases is sending notifications on new releases.