From 10103f8ca81a82b449721d9de0b06305f094fa0e Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev Date: Wed, 18 Aug 2021 23:16:52 +0300 Subject: [PATCH] Support tzlocal>=3.0 #166 --- clickhouse_driver/columns/datetimecolumn.py | 2 ++ clickhouse_driver/columns/numpy/datetimecolumn.py | 2 ++ setup.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clickhouse_driver/columns/datetimecolumn.py b/clickhouse_driver/columns/datetimecolumn.py index 67808fe6..40b6ce81 100644 --- a/clickhouse_driver/columns/datetimecolumn.py +++ b/clickhouse_driver/columns/datetimecolumn.py @@ -194,6 +194,8 @@ def create_datetime_column(spec, column_options): else: if not context.settings.get('use_client_time_zone', False): try: + local_timezone = get_localzone().key + except AttributeError: local_timezone = get_localzone().zone except Exception: local_timezone = None diff --git a/clickhouse_driver/columns/numpy/datetimecolumn.py b/clickhouse_driver/columns/numpy/datetimecolumn.py index 21dab835..9d65e02d 100644 --- a/clickhouse_driver/columns/numpy/datetimecolumn.py +++ b/clickhouse_driver/columns/numpy/datetimecolumn.py @@ -125,6 +125,8 @@ def create_numpy_datetime_column(spec, column_options): # As Numpy do not use local timezone for converting timestamp to # datetime we need always detect local timezone for manual converting. try: + local_timezone = get_localzone().key + except AttributeError: local_timezone = get_localzone().zone except Exception: pass diff --git a/setup.py b/setup.py index 05eee595..f96c7ee5 100644 --- a/setup.py +++ b/setup.py @@ -133,7 +133,7 @@ def read_version(): python_requires='>=3.4.*, <4', install_requires=[ 'pytz', - 'tzlocal<3.0' + 'tzlocal' ], ext_modules=extensions, extras_require={