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 timezone conversion macro on redshift #63

Merged
merged 1 commit into from
Apr 1, 2022

Conversation

msnidal
Copy link
Contributor

@msnidal msnidal commented Mar 31, 2022

Hi there! First of all, thank you for building/maintaining this package, I am using it and it rocks.

When calling a calendar date macro (in my case dbt_date.today() on redshift with dbt 1.0.0, I received the following error:

18:26:50  Encountered an error:
Runtime Error
  Database Error in model util__dates (models/layer_1_cleaned/utils/util__dates.sql)
    syntax error at or near "UTC"
    LINE 18:  at time zone 'UTC' at time zone 'Etc/UTC' as 

I looked into it and basically it seems that the default implementation you had for the timezone conversion is the supported way in redshift, but dbt's dispatch was calling the postgres implementation per its search ordering, but the postgres implementation does not work in redshift.

I consulted the dbt docs to see the best way to handle this and they recommend implementing a redshift dispatch which simply calls the default implementation in cases like this (bottom of page) which seemed reasonable to me. Hence this PR! And thanks again for the package 😄

@clausherther
Copy link
Contributor

Hi @msnidal, thanks for this! Good catch! We don't actually officially support or test on Redshift, but I think it makes sense to include this since it's an easy fix. I'll cut a release later today. 👍

Copy link
Contributor

@clausherther clausherther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clausherther clausherther merged commit cdf6976 into calogica:main Apr 1, 2022
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