Per the Trino documentation the Trino DB-API should correctly map timestamps with time zone to Python datetime objects.
Actual behavior
Per the example provided in the Trino documentation,
from trino.dbapi import connect
cursor = connect(host="localhost").cursor()
cursor.execute("SELECT timestamp '2012-10-31 01:00 UTC' AT TIME ZONE 'America/Los_Angeles'")
rows = cursor.fetchall()
print(rows)
This article outlines the fundamental issue which states,
pytz uses its own non-standard interface for handling time zone information that is partially but not entirely compatible with the way Python's datetime library was intended to work …
See this StackOverflow post for additional information and how time zone localization works with the pytz package.
Expected behavior
Per the Trino documentation the Trino DB-API should correctly map timestamps with time zone to Python
datetime
objects.Actual behavior
Per the example provided in the Trino documentation,
returns
which is incorrect by 53 minutes due to how
pytz
time zones are bound. The expected outcome isSteps To Reproduce
See above.
Log output
This article outlines the fundamental issue which states,
See this StackOverflow post for additional information and how time zone localization works with the
pytz
package.Operating System
Ubuntu
Trino Python client version
0.321.0
Trino Server version
393.0
Python version
3.9.16
Are you willing to submit PR?