clickhouse-connect 1.7.0
clickhouse-connect 1.7.0 adds SQLAlchemy support for JSON subcolumns and materialized CTEs, introduces more control over error messages and naive datetime inserts, and fixes issues across parameter binding, streaming, JSON decoding, DB-API, and SQLAlchemy.
Highlights
Features and improvements
- SQLAlchemy JSON columns now support storage-backed subcolumn access through
column["segment"],column.subcolumn(...), and the typedjson_subcolumn(...)helper. #899 - SQLAlchemy statements can create materialized CTEs through
.cte(..., materialized=True)andcc_sqlalchemy.cte(...). This requires ClickHouse 26.3 or later withenable_materialized_cteand the analyzer enabled. #900 show_clickhouse_errors="scrub"preserves useful server error details while removing the server URL and version trailer. Transport and streaming errors follow the same setting. Invalid values now raiseProgrammingError. #344- The new
naive_datetime_insertsetting controls whether naive Python datetime values use the client host timezone or the column and server timezone. The default remains"local"for compatibility. #938
Bug fixes
- SQLAlchemy and DB-API now handle percent signs in identifiers correctly, including
%2EJSON key encodings. datetime.timeanddatetime.timedeltaquery parameters now bind correctly forTimeandTime64, including nested, negative, extended-duration, timezone-aware, and nanosecond values. SQLAlchemy inserts, comparisons, andliteral_bindsnow support these values too. #919- The DB-API module now provides the standard
Binary,Date,Time,Timestamp, and ticks-based constructors. This also fixes SQLAlchemyLargeBinaryinserts. #919 - Fractional
DateTime64values before the Unix epoch now serialize to the correct second. #938 - Nested compound types containing enum values with escaped quotes now parse correctly. #878
- Nested
Nonevalues in arrays, tuples, and map-formatted maps now render as SQLNULL. #879 - Empty bytes inserted into non-nullable
FixedStringcolumns are now padded correctly. #880 - Settings unavailable through
system.settings, including custom role settings, are now forwarded to ClickHouse for validation. #530 - SQLAlchemy reflection and metadata queries continue returning string identifiers when the global
Stringformat is configured as bytes. #920 - Removing SQL block comments no longer joins adjacent query tokens or causes incorrect client-side
LIMIThandling. #928 - Native streaming now detects complete mid-stream ClickHouse exception blocks across transport chunk boundaries. #915
- DB-API
Cursor.descriptionnow reports accurate top-level nullability and handles empty-result metadata probes more safely. #902, #907, #909 - Compound and temporal values stored in JSON shared data now decode to Python values instead of raw bytes. #897
- Async streaming cleanup now runs on the event-loop thread, preserving the original
StreamFailureErrorwhen TLS queries fail mid-stream.
Compatibility notes
- Runtime compatibility branches for unsupported ClickHouse versions older than 25.8 have been removed. ClickHouse 25.8 is now the supported baseline.
datetime.timeanddatetime.timedeltaparameters are now quoted by the driver. Remove manual quotes around existing%(name)splaceholders. #919- Naive datetime query parameters now represent wall time in the target timezone. Set
common.set_setting("naive_datetime_binding", "legacy")to restore the previous host-timezone conversion behavior. #938
Installation
pip install clickhouse-connect