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

Optimize 2021-09-11-sql-dateadd.md #1244

Merged
merged 7 commits into from
Mar 30, 2022

Conversation

johnblust
Copy link
Contributor

@johnblust johnblust commented Mar 17, 2022

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.

@johnblust johnblust requested a review from krevitt March 17, 2022 19:00
@johnblust johnblust requested a review from a team as a code owner March 17, 2022 19:00
@netlify
Copy link

netlify bot commented Mar 17, 2022

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit 1be3506
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/62446b2c06403f00090fc97d
😎 Deploy Preview https://deploy-preview-1244--docs-getdbt-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the size: small This change will take 1 to 2 days to address label Mar 17, 2022
Copy link
Contributor

@krevitt krevitt left a 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

website/blog/2021-09-11-sql-dateadd.md Outdated Show resolved Hide resolved
website/blog/2021-09-11-sql-dateadd.md Outdated Show resolved Hide resolved

```sql
dateadd( {{ datepart }}, {{ interval }}, {{ from_date }} )
```

*Hour, minute and second are supported!*

### In BigQuery…
### The DATEADD Function in Databricks
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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!!

@johnblust johnblust removed the request for review from a team March 24, 2022 16:25
@johnblust
Copy link
Contributor Author

Added the necessary disclaimer, merging PR

@johnblust johnblust merged commit 57f86f8 into current Mar 30, 2022
@johnblust johnblust deleted the optimize-dateadd-across-data-warehouses branch March 30, 2022 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants