Skip to content

Remove deprecated utc_tz_aware parameter#669

Open
joe-clickhouse wants to merge 2 commits intomainfrom
joe/665-remove-deprecated-utc_tz_aware-parameter
Open

Remove deprecated utc_tz_aware parameter#669
joe-clickhouse wants to merge 2 commits intomainfrom
joe/665-remove-deprecated-utc_tz_aware-parameter

Conversation

@joe-clickhouse
Copy link
Contributor

Summary

Remove all utc_tz_aware deprecation scaffolding introduced in #664. The tz_mode parameter is now the only way to control timezone behavior.

@joe-clickhouse joe-clickhouse added the hold for 1.0.0 hold off merging until we're ready for 1.0.0 label Mar 5, 2026
@joe-clickhouse joe-clickhouse linked an issue Mar 5, 2026 that may be closed by this pull request
@joe-clickhouse joe-clickhouse self-assigned this Mar 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the deprecated utc_tz_aware API surface (and its deprecation bridge introduced in #664) so tz_mode is the only supported mechanism for controlling DateTime timezone behavior across the driver.

Changes:

  • Removed utc_tz_aware parameters/properties and _resolve_tz_mode deprecation scaffolding from driver/query & client APIs.
  • Updated sync/async client call paths to accept/pass tz_mode only.
  • Removed unit tests covering the deprecated bridge and added a 1.0.0 breaking-change note in the changelog.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/unit_tests/test_driver/test_query.py Removes tests/imports that specifically validated deprecated utc_tz_aware behavior.
clickhouse_connect/driver/query.py Deletes utc_tz_aware bridge logic and validates tz_mode directly in QueryContext.
clickhouse_connect/driver/httpclient.py Removes utc_tz_aware ctor parameter and stops passing it into Client.
clickhouse_connect/driver/client.py Removes utc_tz_aware from client/query method signatures and validates tz_mode directly.
clickhouse_connect/driver/asyncclient.py Removes utc_tz_aware from async method signatures and forwarding calls.
clickhouse_connect/driver/__init__.py Removes deprecated param docs for create_client/create_async_client.
CHANGELOG.md Adds a 1.0.0 breaking-change entry for removing utc_tz_aware.
Comments suppressed due to low confidence (1)

CHANGELOG.md:32

  • The UNRELEASED breaking-change bullet still claims utc_tz_aware is accepted with a DeprecationWarning, but this PR removes utc_tz_aware entirely. Update or remove this bullet so UNRELEASED accurately reflects current behavior.
### Breaking Changes
- Renamed `utc_tz_aware` parameter to `tz_mode` across Client, QueryContext, and all query methods. The new `tz_mode` parameter accepts string values: `"naive_utc"` (default, was `False`), `"aware"` (was `True`), and `"schema"` (unchanged). The old `utc_tz_aware` parameter is still accepted but emits a `DeprecationWarning` and will be removed in 1.0. Passing both `tz_mode` and `utc_tz_aware` raises `ProgrammingError`. Closes [#654](https://github.com/ClickHouse/clickhouse-connect/issues/654)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +24 to +28
## 1.0.0

### Breaking Changes
- Removed the deprecated `utc_tz_aware` parameter entirely. Use `tz_mode` instead: `"naive_utc"` (default, was `False`), `"aware"` (was `True`), or `"schema"` (unchanged). Closes [#654](https://github.com/ClickHouse/clickhouse-connect/issues/654), [#665](https://github.com/ClickHouse/clickhouse-connect/issues/665)

Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG structure is inconsistent: a "1.0.0" section is placed above "UNRELEASED" even though subsequent entries are still under UNRELEASED. Typically UNRELEASED should remain the top section until the release is cut; consider moving this breaking-change entry under UNRELEASED (or moving the 1.0.0 header below UNRELEASED) until 1.0.0 is actually released/dated.

Copilot uses AI. Check for mistakes.
Comment on lines 81 to 84
:param tz_mode Controls timezone-aware behavior for UTC DateTime columns. "naive_utc" (default) returns
naive UTC timestamps. "aware" forces timezone-aware UTC datetimes. "schema" returns datetimes that
match the server's column definition which means timezone-aware when the column defines a timezone and naive
for bare DateTime columns.
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because create_client/create_async_client accept arbitrary **kwargs, callers can still pass utc_tz_aware, which will now fail with a generic TypeError (or may be mis-routed as a server setting when coming from generic_args). Consider explicitly detecting utc_tz_aware and raising a ProgrammingError with a clear message directing users to tz_mode.

Copilot uses AI. Check for mistakes.
Comment on lines 79 to 81
apply_server_timezone: Optional[Union[str, bool]] = None,
tz_mode: Optional[str] = None,
utc_tz_aware: Optional[Union[bool, Literal["schema"]]] = None,
show_clickhouse_errors: Optional[bool] = None,
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tz_mode is annotated as Optional[str] here, but the codebase defines a TzMode Literal type and uses it in other public APIs (e.g., Client, AsyncClient, QueryContext). Updating this annotation to Optional[TzMode] would keep type hints consistent for users and static checkers.

Copilot uses AI. Check for mistakes.
Comment on lines +116 to +118
self.tz_mode = tz_mode if tz_mode is not None else "naive_utc"
if self.tz_mode not in _VALID_TZ_MODES:
raise ProgrammingError(f'tz_mode must be "naive_utc", "aware", or "schema", got "{self.tz_mode}"')
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timezone mode validation logic (defaulting + membership check + error message) is now duplicated here and in Client.__init__. To avoid future drift in behavior/error messages, consider centralizing validation in a shared helper (even if utc_tz_aware support is gone).

Copilot uses AI. Check for mistakes.
Comment on lines +125 to +127
self.tz_mode = tz_mode if tz_mode is not None else "naive_utc"
if self.tz_mode not in _VALID_TZ_MODES:
raise ProgrammingError(f'tz_mode must be "naive_utc", "aware", or "schema", got "{self.tz_mode}"')
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repeats the tz_mode defaulting/validation logic that also exists in QueryContext.__init__. Consider using a shared validator to keep defaults and error messaging consistent across the API surface.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold for 1.0.0 hold off merging until we're ready for 1.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove deprecated utc_tz_aware parameter

3 participants