Closed alittlesliceoftom closed 1 month ago
See docs here: https://duckdb.org/docs/sql/functions/date.html
I didn't have time to setup integration tests, but tested the updated macro locally, and 'correct' example now works:
SELECT {{ dateadd(datepart="month", interval=1, from_date_or_timestamp="'2021-08-12'") }} AS period_of_load
yeah I'm surprised this didn't break on the regular unit tests-- like, does this not work anymore and I missed it? https://github.com/dbt-labs/dbt-adapters/blob/main/dbt-tests-adapter/dbt/tests/adapter/utils/fixture_dateadd.py
Possibly those are more explicit strings? So inference can work?
My concern here is what happens if I pass in a TIMESTAMP
instead of a string or a DATE
? Or a string that should be cast as a TIMESTAMP
instead?
Yeh... Interestingly in DuckDb the dateadd operations seem to expect the coder to know and set the type ahead of time in the statement? https://duckdb.org/docs/sql/functions/interval
Closing this out as I believe the code was working the way dbt intended
Fixes #405
tl;dr, helps you avoid errors like: