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

Document the where property of generic tests #1060

Closed
wants to merge 3 commits into from

Conversation

shippy
Copy link
Contributor

@shippy shippy commented Jan 27, 2022

Description & motivation

This PR describes the where property of generic tests in an FAQ on the main "Tests" docs page. I'm adding it because I've found the property very useful, but information about it has been hard to find.

Pre-release docs

Is this change related to an unreleased version of dbt?

  • Yes: please
    • update the base branch to next
    • add Changelog components: <Changelog>[New/Changed] in v0.x.0</Changelog>
    • add links to the "New and changed documentation" section of the latest Migration Guide
  • No: please ensure the base branch is current
  • Unsure: we'll let you know!

@runleonarun runleonarun added improvement Use this when an area of the docs needs improvement as it's currently unclear size: small This change will take 1 to 2 days to address labels Feb 1, 2022
@runleonarun
Copy link
Collaborator

Thank you for opening this PR, @shippy (love this username!) We will review this content as soon as we can.

@shippy
Copy link
Contributor Author

shippy commented Feb 2, 2022

Ha, actually tried the suggested where example with dateadd (previously I stuck to where: "received_at <= '{{ modules.datetime.date.today() - modules.datetime.timedelta(days=1) }}'") and it turns out it's database-specific, i.e. dateadd doesn't work on Postgres. A database-agnostic solution like dbt_utils.dateadd is (1) not a good fit for core docs and (2) I can't actually make it work in a YAML file, so I'll come up with a different example.

@runleonarun
Copy link
Collaborator

I wonder if @jtcohen6 has any thoughts on this.

@jtcohen6
Copy link
Collaborator

jtcohen6 commented Feb 7, 2022

Unfortunately, test configs (including where) don't support macros in their parsing/compilation context today (dbt-labs/dbt-core#4103), so it isn't possible to use dbt_utils.dateadd.

IMO explicitly mentioning that the example uses PostgreSQL syntax would be okay

@shippy
Copy link
Contributor Author

shippy commented Feb 7, 2022

Added a comment stating the dateadd syntax is Snowflake-specific. (Going off of this blogpost.)

@shippy
Copy link
Contributor Author

shippy commented Apr 19, 2022

Note to self that maybe this should link the current where documentation, which I found by accident the other day.

@netlify
Copy link

netlify bot commented Apr 20, 2022

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit 1e411d0
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/625f767580bddc00088df0bb
😎 Deploy Preview https://deploy-preview-1060--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.

@shippy
Copy link
Contributor Author

shippy commented Apr 20, 2022

I looked at some other FAQs that linked resource configs and modeled the link on them, but I haven't actually built the docs site locally, so I don't know if it works correctly.

@netlify
Copy link

netlify bot commented Aug 26, 2022

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit 9ba19a0
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/620154aec69a160007071021
😎 Deploy Preview https://deploy-preview-1060--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.

@netlify
Copy link

netlify bot commented Aug 26, 2022

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit be9ce0d
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/61f22ad7df8265000716bf70
😎 Deploy Preview https://deploy-preview-1060--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.

@mirnawong1 mirnawong1 added the merge-conflict-cli This PR has a merge conflict that needs to be resolved label Nov 30, 2022
@runleonarun
Copy link
Collaborator

We appreciate your contributions to the dbt product documentation! Unfortunately, we are closing this PR as outdated with merge conflicts. We don't have permissions to edit this fork to fix the merge conflicts so we cannot update this content for publishing.

Feel free to open a new PR if you want to add this content to the docs! 🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Use this when an area of the docs needs improvement as it's currently unclear merge-conflict-cli This PR has a merge conflict that needs to be resolved 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.

4 participants