Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make timezone for presto configurable via parameters #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pyhive/presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)}``.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down