Skip to content

Commit

Permalink
Support tzlocal>=3.0 #166
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed Aug 18, 2021
1 parent d6b263e commit 10103f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions clickhouse_driver/columns/datetimecolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions clickhouse_driver/columns/numpy/datetimecolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def read_version():
python_requires='>=3.4.*, <4',
install_requires=[
'pytz',
'tzlocal<3.0'
'tzlocal'
],
ext_modules=extensions,
extras_require={
Expand Down

0 comments on commit 10103f8

Please sign in to comment.