Duck Db support of DATEADD from Core
alittlesliceoftom opened this issue · 1 comments
alittlesliceoftom commented
I tried the example here:
https://docs.getdbt.com/sql-reference/dateadd
SELECT {{ dateadd(datepart="month", interval=1, from_date_or_timestamp="'2021-08-12'") }}
This fails.
I tweaked and this works:
SELECT {{ dateadd(datepart="month", interval=1, from_date_or_timestamp="DATE '2021-08-12'") }} AS period_of_load
In general I think adapters should support the documented case from core.
Here duckdb seems to want date strings to be explicitly refererred to as dates in addition operations as per: https://duckdb.org/docs/sql/functions/date.html
As such I suggest that :
https://github.com/duckdb/dbt-duckdb/blob/master/dbt/include/duckdb/macros/utils/dateadd.sql
Is updated to include: DATE at start
alittlesliceoftom commented
Context, I'm trying to complete this issue: alittlesliceoftom/insert_by_timeperiod#2 on the insert by timeperiod repo, and struggling here with duck db compatability.