How to handle timestamps #467
Unanswered
david-waterworth
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a
Postgres
table containing a timestamp column in UTC (i.e. the Postgres type istimestamptz
- timestamp with timezone)If I query using
connector-x
the pyarrow.Table has typetimezone[ns, tz=UTC]
- this is sortable but doesn't allow me to create timezone features such as the number of events per day without converting to saytimezone[ns, tz=Australia/Sydney]
If I perform the timezone conversion on the server, postgres converts to a returns a
timestamp
- timestamp without timezone) meaning I can create timezone features but cannot correctly sort. The arrow type istimezone[ns]
It seems that in order to return a postgres
timestamptz
in a specified timezone requiresBut connector-x doesn't appear to allow this?
Otherwise I have to either return both the ts_utc as timestamp[ns, tz=UTC] and ts_local as timestamp[ns] in order to support both sorting and calendar based features, or return ts_utc as timestamp[ns, tz=UTC] and replace it with ts_local as timestamp[ns, tz=Australia/Sydney] on the client.
Are there better options?
Beta Was this translation helpful? Give feedback.
All reactions