-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snowflake JDBC driver incorrectly converts JDBC dates with a timezone #8804
Comments
Hey @senior, would this bug also affect timestamps with timezones being displayed incorrectly in results? The below query displays correctly when running against Redshift, but not for Snowflake (expect the LA timestamp to match the to_char version): |
Not sure if this is exactly the same problem, but I also have issues with snowflake and time zones. First posted here: https://discourse.metabase.com/t/local-timezone-when-data-is-in-utc-implicitly-using-snowflake/9961 So, in snowflake I have this table, where all the dates are in UTC:
If I put reporting time zone to UTC everything work as expected. But I want to use Some examples with metabase report time zone set to Visualizing the values in the table: Queries to Snowflake:
Result in Metabase:
Summarize row count by day Snowflake queries:
Result in metabase:
Summarize row count by day, filter on date (Ts is before May 1, 2017) Snowflake queries:
Result in metabase:
|
@HugoManoMano No changes since I wrote the comment. For now Ive put reporting time zone to UTC, but it would be great to make it work properly with all time zones. |
We had a similar issue and fixed it by ensuring that our |
Thanks for your answers ! Setting the JAVA_TIMEZONE as the same as our reporting timezone seems to have solved the problem when set to UTC (we had Europe/Paris before on both side but this didn't work). I guess we'll run it that way for the moment ; thanks @spencerschack |
Hi everyone Can you please confirm that the right syntax in the DB connection page is this : user.timezone=UTC ? I used to have 24:00:00 displayed as time part for DATE columns. |
@eozturkTF You need to start Metabase with the Java parameter ... To help figuring out solutions, please provide "Diagnostic Info" from Admin > Troubleshooting, and run the following query and provide a screenshot of the output: select
current_timestamp(), current_timestamp()::text,
convert_timezone('UTC', current_timestamp()) utc, convert_timezone('UTC', current_timestamp())::text utctext,
convert_timezone('America/New_York', current_timestamp()) ny, convert_timezone('America/New_York', current_timestamp())::text nytext,
convert_timezone('Asia/Bangkok', current_timestamp()) bk, convert_timezone('Asia/Bangkok', current_timestamp())::text bktext |
When dealing with the older (pre JDK 8) dates, the dates are always converted to the JVM timezone. The can present a problem when using Metabase's
report-timezone
feature, which will set the database sessions timezone to the user configured value. When filtering based on a date and thereport-timezone
is specified, that date needs to also be in the report timezone. Since the JVM always converts the date to the JVM's timezone (and there is no tracking of an "original" timezone) the JDBC library allows the timezone to be included as a separate parameter.This doesn't appear to work correctly with Snowflake as when that parameter is included, it looks to be double converting the values. Creating this to track the issue and for linking to the tests with the incorrect values so it can be fixed after Snowflake support is merged.
⬇️ Please click the 👍 reaction instead of leaving a
+1
orupdate?
commentThe text was updated successfully, but these errors were encountered: