Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Conversation

@bjoernhaeuser
Copy link
Contributor

It looks like changing the session timezone does not change the timestamp output, therefore converting the timezone directly to UTC.

@bjoernhaeuser bjoernhaeuser changed the title Conver timezone Convert timezone Feb 16, 2023
@erezsh
Copy link
Contributor

erezsh commented Feb 16, 2023

@bjoernhaeuser Any chance you could include a test for this behavior?

@bjoernhaeuser
Copy link
Contributor Author

@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)
Copy link
Contributor Author

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)"
Copy link
Contributor Author

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()
Copy link
Contributor Author

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.

@bjoernhaeuser bjoernhaeuser force-pushed the patch-1 branch 2 times, most recently from b6a5637 to 3424ecb Compare February 27, 2023 15:16
@bjoernhaeuser
Copy link
Contributor Author

@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.
@erezsh
Copy link
Contributor

erezsh commented Mar 4, 2023

I will soon.

erezsh added a commit that referenced this pull request Mar 10, 2023
PR #20 with added infrastructure (TimestampTZ repr)
@erezsh erezsh merged commit e5b34f3 into datafold:master Mar 10, 2023
@erezsh
Copy link
Contributor

erezsh commented Mar 10, 2023

Thank you for contributing!

@bjoernhaeuser bjoernhaeuser deleted the patch-1 branch March 10, 2023 12:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants