-
Notifications
You must be signed in to change notification settings - Fork 12
Convert timezone #20
Convert timezone #20
Conversation
|
@bjoernhaeuser Any chance you could include a test for this behavior? |
|
@erezsh I was able to add a test-case which only works for snowflake right now. Do you have an idea how to make this run on all databases? |
| return _database_instances[cls] | ||
|
|
||
| return connect(CONN_STRINGS[cls], N_THREADS) | ||
| con = sqeleton.connect.load_mixins(AbstractMixin_NormalizeValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was required to get the "NormalizeAsString" working, not sure if this is actually required?
| name = "tbl_" + random_table_suffix() | ||
| db = get_conn(self.db_cls) | ||
| tbl = table(db.parse_table_name(name), schema={ | ||
| "id": int, "created_at": "timestamp_tz(9)", "updated_at": "timestamp_tz(9)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timestamp_tz(9) is database vendor agnostic, unfortunately. I have no idea how to make this work with the generic approach. Any hints on this? Thanks.
| db.query(table(db.parse_table_name(name)).insert_row("1", now, now)) | ||
| db.query(db.dialect.set_timezone_to_utc()) | ||
|
|
||
| t = db.table(name).query_schema() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is refreshing the schema, to actually get the correct timezones/datatype values.
b6a5637 to
3424ecb
Compare
|
@erezsh Would you be able to take another look at this? Thanks. |
Changing the session timezone does not change the timestamp output, therefore converting the timezone directly to UTC.
|
I will soon. |
PR #20 with added infrastructure (TimestampTZ repr)
|
Thank you for contributing! |
It looks like changing the session timezone does not change the timestamp output, therefore converting the timezone directly to UTC.