Skip to content
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

fix: datadiff week inconsistency between SQL Server and Snowflake (DNA-17332 / DNA-19251) #66

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

Dennis-UiPath
Copy link
Contributor

Description

  • The output for datediff using week as datepart is not the same for SQL Server and Snowflake. The difference is caused because Snowflake and SQL Server use a different day as start of the week, for Snowflake this is Monday, for SQL Server this is Sunday. This fix aligns both (week starting on Monday).

Release

  • Direct release (main)
  • Merge to dev (or other) branch
    • Why:

Did you consider?

  • Does it Work on Automation Suite / SQL Server
  • Does it Work on Automation Cloud / Snowflake
    - [ ] What is the performance impact?
  • The version number in dbt_project.yml
    • We will release this together with the next update for pm_utils

@silviustanimir silviustanimir self-requested a review October 3, 2023 08:33
@silviustanimir
Copy link
Contributor

This is a setting for both SQL Server and Snowflake.
Indeed they have different default, but I'm wondering whether we should actually apply this change or just refer into our documentation that this difference may exist.

@Dennis-UiPath
Copy link
Contributor Author

This is a setting for both SQL Server and Snowflake. Indeed they have different default, but I'm wondering whether we should actually apply this change or just refer into our documentation that this difference may exist.

For SQL Server the datediff_big function does not use the setting to make it deterministic: https://learn.microsoft.com/en-us/sql/t-sql/functions/datediff-big-transact-sql?view=sql-server-ver16#remarks

@Dennis-UiPath Dennis-UiPath merged commit ecfb12c into main Oct 3, 2023
2 checks passed
@Dennis-UiPath Dennis-UiPath deleted the fix_datediff_week_sqlserver branch October 3, 2023 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants