# Option 1 - with http header
connect_args["protocol"] = "https"
connect_args["http_headers"] = {"X-Presto-Time-Zone": "America/New_York"}
# Option 2 - with session properties
connect_args["session_props"] = {"timezone": "America/Los_Angeles"}
# Or
# connect_args["session_properties"] = {"timezone": "America/Los_Angeles"}
E sqlalchemy.exc.DatabaseError: (pyhive.exc.DatabaseError) {'message': 'Unknown session property timezone', 'errorCode': 14, 'errorName': 'INVALID_SESSION_PROPERTY', 'errorType': 'USER_ERROR', 'retriable': False, 'failureInfo': {'type': 'com.facebook.presto.spi.PrestoException', 'message': 'Unknown session property timezone', 'suppressed': [], 'stack': ['com.facebook.presto.metadata.SessionPropertyManager.lambda$validateSystemSessionProperty$2(SessionPropertyManager.java:191)', 'java.base/java.util.Optional.orElseThrow(Optional.java:408)', 'com.facebook.presto.metadata.SessionPropertyManager.validateSystemSessionProperty(SessionPropertyManager.java:191)', 'com.facebook.presto.Session.beginTransactionId(Session.java:349)', 'com.facebook.presto.execution.QueryStateMachine.beginWithTicker(QueryStateMachine.java:254)', 'com.facebook.presto.execution.QueryStateMachine.begin(QueryStateMachine.java:219)', 'com.facebook.presto.dispatcher.LocalDispatchQueryFactory.createDispatchQuery(LocalDispatchQueryFactory.java:144)', 'com.facebook.presto.dispatcher.DispatchManager.createQueryInternal(DispatchManager.java:312)', 'com.facebook.presto.dispatcher.DispatchManager.lambda$createQuery$0(DispatchManager.java:254)', 'com.facebook.airlift.concurrent.BoundedExecutor.drainQueue(BoundedExecutor.java:78)', 'java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)', 'java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)', 'java.base/java.lang.Thread.run(Thread.java:829)']}}
Configuring the presto's timezone in SQLAlchemy's
create_enginefunction failed.Details
Code:
Error:
The raw
presto.connect(...)also failed withsession_propertiesDetails
Code: ``` conn = presto.connect( host="localhost", port=8080, username="user", catalog="memory", schema="default", session_properties={ "timezone": "UTC", # or "session.time_zone": "America/New_York", }, ) ```
Error:
Is there a documentation about how to set timezone for presto connections (SQLAlchemy)? Or it is about SQLAlchemy or PyHive version? For the above experiment, the version SQLAlchemy is
1.4.46and the version of PyHive is0.7.0. The presto local instance has image tag0.286.Executing
SET SESSION timezone = 'UTC';in the presto instance also errored out: