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

Duck Db support of DATEADD from Core #405

Open
alittlesliceoftom opened this issue Jun 19, 2024 · 1 comment · May be fixed by #406
Open

Duck Db support of DATEADD from Core #405

alittlesliceoftom opened this issue Jun 19, 2024 · 1 comment · May be fixed by #406

Comments

@alittlesliceoftom
Copy link

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
Copy link
Author

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.

@alittlesliceoftom alittlesliceoftom linked a pull request Jun 19, 2024 that will close this issue
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 a pull request may close this issue.

1 participant