From b5c906a65cec539c4364aa7c72963a70f343c301 Mon Sep 17 00:00:00 2001 From: Marc Zoeller Date: Wed, 23 Sep 2020 17:29:17 +0200 Subject: [PATCH] Make timezone for presto configurable via parameters --- pyhive/presto.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyhive/presto.py b/pyhive/presto.py index a38cd891..9f1f5efe 100644 --- a/pyhive/presto.py +++ b/pyhive/presto.py @@ -91,7 +91,7 @@ class Cursor(common.DBAPICursor): def __init__(self, host, port='8080', username=None, principal_username=None, catalog='hive', schema='default', poll_interval=1, source='pyhive', session_props=None, - protocol='http', password=None, requests_session=None, requests_kwargs=None, + protocol='http', tz=None, password=None, requests_session=None, requests_kwargs=None, KerberosRemoteServiceName=None, KerberosPrincipal=None, KerberosConfigPath=None, KerberosKeytabPath=None, KerberosCredentialCachePath=None, KerberosUseCanonicalHostname=None): @@ -108,6 +108,7 @@ def __init__(self, host, port='8080', username=None, principal_username=None, ca :param source: string -- arbitrary identifier (shows up in the Presto monitoring page) :param protocol: string -- network protocol, valid options are ``http`` and ``https``. defaults to ``http`` + :param tz: string -- timezone to use for timezone-aware timestamps. Defaults to ``None``. :param password: string -- Deprecated. Defaults to ``None``. Using BasicAuth, requires ``https``. Prefer ``requests_kwargs={'auth': HTTPBasicAuth(username, password)}``. @@ -151,6 +152,7 @@ class will use the default requests behavior of making a new session per HTTP re self._username = principal_username or username or getpass.getuser() self._catalog = catalog self._schema = schema + self._tz = tz self._arraysize = 1 self._poll_interval = poll_interval self._source = source @@ -244,6 +246,7 @@ def execute(self, operation, parameters=None): 'X-Presto-Schema': self._schema, 'X-Presto-Source': self._source, 'X-Presto-User': self._username, + 'X-Presto-Time-Zone': self._tz, } if self._session_props: