From a3b4e4a63da56b8d3abe094e724e903e654d517a Mon Sep 17 00:00:00 2001 From: jinyang_li Date: Mon, 14 Jul 2025 14:05:34 -0700 Subject: [PATCH] import get_localzone_name only if timezone not avaiable --- trino/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trino/client.py b/trino/client.py index 7cc1f0f2..f6233dec 100644 --- a/trino/client.py +++ b/trino/client.py @@ -71,7 +71,6 @@ from requests import Response from requests import Session from requests.structures import CaseInsensitiveDict -from tzlocal import get_localzone_name # type: ignore import trino.logging from trino import constants @@ -184,9 +183,12 @@ def __init__( self._extra_credential = extra_credential self._client_tags = client_tags.copy() if client_tags is not None else list() self._roles = self._format_roles(roles) if roles is not None else {} - self._timezone = timezone or get_localzone_name() if timezone: # Check timezone validity ZoneInfo(timezone) + self._timezone = timezone + else: + from tzlocal import get_localzone_name + self._timezone = get_localzone_name() self._encoding = encoding @property