clickhouse-connect 1.4.0
This is a minor release. It adds experimental free-threading support, ships type information for downstream type checkers, and fixes bugs across the core client, the DB-API cursor, and the SQLAlchemy dialect.
Highlights
Features and improvements
- Free-threading compatibility. The Cython extension modules now declare free-threading support, so importing clickhouse-connect on a free-threaded build such as Python 3.14t no longer silently re-enables the GIL. Free-threading support remains experimental. The CI suite now runs the full test matrix on 3.14t as a non-blocking job.
- PEP 561 type information. The package now ships a
py.typedmarker so downstream type checkers can use its annotations. #692 Noneforportanddatabase.create_client,create_async_client,connect(), and the DB-APIConnectionconstructor now acceptNoneto request the driver's defaults, in addition to omitting them. The internal sentinel values are still accepted, so this is backward compatible. #801QueryResult.query_idnow returns an empty string instead ofNonewhen the server reported no query id. This matchesQuerySummaryand keeps the property consistently typed asstr.
Bug fixes
QueryResult.first_itemandQueryResult.first_rownow returnNonefor an empty result set instead of raisingIndexError. #824Cursor.executemanynow resetsrowcountand reports the number of inserted rows after a bulk insert, and appends the insert summary tocursor.summary. Passing a generator asseq_of_parametersno longer raisesTypeError. The bulk-insert optimization is skipped for non-indexable iterables and falls through to the row-by-row path as PEP 249 requires.- A connection failure partway through reading a query result is no longer silently treated as a complete result. A mid-stream read failure now raises
StreamFailureError, carrying the server-side error message when ClickHouse reported one. #802 Client.insert_arrowandAsyncClient.insert_arrowno longer drop thetransport_settingsargument. It was passed positionally into thecompressionparameter, so transport settings were ignored. It is now forwarded correctly.commandnow raisesProgrammingErrorwhen binary parameter binds are combined with command data or external data, instead of placing binary content into the URL query string. This applies to both the sync and async clients.- Importing clickhouse-connect no longer emits a
DeprecationWarningfor the array'u'type code. This also lets projects that run with-W errorimport the package. #815 - The SQLAlchemy
NullableandLowCardinalityDDL helpers are now functions that return a concreteChSqlaType, soArray(LowCardinality(String))no longer raises a spurious mypy error. Runtime behavior is unchanged. #819
Compatibility
Client.insert,AsyncClient.insert, andraw_insertnow requirecolumn_namesto be aSequencerather than a bareIterable. A one-shot iterator such as a generator already failed at runtime because the column names are measured and iterated more than once, so the type hint now matches the real requirement.
Upgrade notes
- Building from source now requires Cython 3.1 or later.
- If you pass
column_namesas a generator or other one-shot iterator, switch to aSequencesuch as a list or tuple. This path already failed at runtime.
Installation
pip install clickhouse-connect