-
Notifications
You must be signed in to change notification settings - Fork 975
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
Optimize 2021-09-11-sql-dateadd.md #1244
Conversation
✅ Deploy Preview for docs-getdbt-com ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spirit of these changes looks good, left a few comments to clean up before merging
|
||
```sql | ||
dateadd( {{ datepart }}, {{ interval }}, {{ from_date }} ) | ||
``` | ||
|
||
*Hour, minute and second are supported!* | ||
|
||
### In BigQuery… | ||
### The DATEADD Function in Databricks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually don't believe dateadd in dbt_utils is compatible with databricks (looking at the databricks function docs for date_add: https://docs.databricks.com/sql/language-manual/functions/date_add.html). This is a good one to confirm w/ DX (likely Joel) though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joellabes What are your thoughts?
Some context: This post ran through how to use DATEADD in each warehouse so I decided to add to add a Databricks section to the content. We're not sure about compatibility with dbt_utils. If not, I should probably just remove the section for Databricks again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dbt utils itself only supports BQ/SF/RS/Postgres, but other packages can implement overrides. That is done here for dateadd on spark (which powers Databricks, right?) https://github.com/dbt-labs/spark-utils/blob/main/macros/dbt_utils/cross_db_utils/dateadd.sql
So yes you can include Databricks in this.
Note that these will be moving to dbt core in v1.2: dbt-labs/dbt-core#4813
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, so I'll make a note of that in this section of the content. Thanks Joel!!
Added the necessary disclaimer, merging PR |
Description & motivation
The H1s and H2s weren’t explicitly targeting “dateadd sql." Adding keyword to metas and headers to optimize structure. Also added a "### DATEADD Function in Databricks" section.