What's Changed
Improvements
-
BREAKING CHANGE: Implement native write path for
Variantdata type with type-aware dispatching. Previously, all values inserted into aVariantcolumn were stringified and sent to the server, which would store them in theStringmember if present, or attempt server-side conversion otherwise. Values are now serialized using their native ClickHouse types client-side (e.g. inserting100intoVariant(Int64, String)storesInt64(100)instead ofString("100")).Key changes:
- Values that don't match any variant member now raise
DataErrorinstead of being stringified and
delegated to the server. - A
typed_variant(value, 'TypeName')helper is provided for cases where automatic dispatch
cannot resolve the target type, such as when multiple variant members map to the same Python
type (e.g.Array(UInt32)vsArray(String)).
- Values that don't match any variant member now raise
-
Added
utc_tz_aware="schema"mode which returns timezone-aware datetimes only when the server's column schema explicitly defines a timezone (e.g.DateTime('UTC')), and naive datetimes for bareDateTimecolumns. This matches the ClickHouse schema definition exactly. Not yet supported for Arrow-based query methods. Closes #645 -
Add type annotations to public API methods in
Client,AsyncClient,HttpClient, andQueryResult. Ref #567
Bug Fixes
- Fix
dict_addparameter typed as builtinanyinstead oftyping.Any. - Recognize
UPDATEas a command so lightweight updates work correctly viaclient.query()and SQLAlchemy. - SQLAlchemy:
GROUP BYnow renders label aliases instead of full expressions which avoids circular reference errors when an alias shadows a source column name in ClickHouse.
Full Changelog: v0.11.0...v0.13.0