-
Notifications
You must be signed in to change notification settings - Fork 510
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
Update documentation for the datedifff macro: add another set of quotes #163
Comments
Hi @louisguitton, the macro is supported on Redshift via the default implementation. Often, when Redshift returns an error like
This indicates an issue with the datatypes of the arguments passed. Specifically, the third argument is |
You're right about the datatype of the argument. I realised that shortly after writing the issue. But I still can't make the macro work unfortunately. Working dbt code without the macro Select
...
where p.published_at between dateadd(day, -5, '2019-09-24') and '2019-09-24' With the macro - not working Select
...
where p.published_at between {{ dbt_utils.dateadd('day', -5, '2019-09-24') }} and '2019-09-24' When I look at the compiled SQL for that latter version, I get Select
...
where p.published_at between
dateadd(
day,
-5,
2019-09-24 -- instead of '2019-09-24'
)
and '2019-09-24' which explains the |
this macro doesn't automatically add quotes to the
There's another macro in this package, literal, that will add this second set of quotes for you. That would look like:
Both of these are equivalent, so sort of up to your preference which one you use! Let's update the documentation here to correctly show usage information for the |
Hey everyone,
it is my understanding from using
dbt_utils.dateadd
this morning on a Redshift cluster and failing that the macro is not supported for Redshfit.Error
Code https://github.com/fishtown-analytics/dbt-utils/blob/master/macros/cross_db_utils/dateadd.sql
I'm willing to open a PR for this and dig deeper into the logic of
adapter_macro
etc. if that sounds like something that could be useful (for my own usecase I just wrote manually thedate_add
redshift statement).The text was updated successfully, but these errors were encountered: