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

New test: accepted_range #276

Merged
merged 5 commits into from
Sep 15, 2020
Merged

New test: accepted_range #276

merged 5 commits into from
Sep 15, 2020

Conversation

joellabes
Copy link
Contributor

@joellabes joellabes commented Sep 7, 2020

This is a:

  • bug fix PR with no breaking changes (please change the base branch to main)
  • new functionality
  • a breaking change

Description & motivation

This adds an accepted_range test, allowing users to ensure things like that a percentage is between 0 and 100, or that all accounts were created in the past. Technically, if you made a test with a min_value of 'A' and max_value of '[', I guess you could also check that all names started with a capital letter, but you shouldn't.

I'm open to discussion on the min_value and max_value arguments. I'm tempted to call them greater_than and less_than because I feel like that might make more sense when you're not comparing a scalar number, but I think it's friendlier for the most common case right now.

Checklist

  • I have verified that these changes work locally on the following warehouses (Note: it's okay if you do not have access to all warehouses, this helps us understand what has been covered)
    • BigQuery
    • Postgres
    • Redshift
    • Snowflake
  • I have updated the README.md (if applicable)
  • I have added tests & descriptions to my models (and macros if applicable)
  • I have added an entry to the changelog

@clrcrl
Copy link
Contributor

clrcrl commented Sep 8, 2020

This looks :chefs_kiss:. Lol.

I will test it out later this week :)

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@joellabes
Copy link
Contributor Author

@clrcrl README mistakes are fixed, thanks for catching them! I can see the CI tests failed but can't log into CircleCI to see why - are they mine?

Copy link
Contributor

@clrcrl clrcrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're missing a columns: entry, which is causing the tests to fail

integration_tests/models/schema_tests/schema.yml Outdated Show resolved Hide resolved
Co-authored-by: Claire Carroll <[email protected]>
@clrcrl
Copy link
Contributor

clrcrl commented Sep 14, 2020

Kickin' off those tests now!

@clrcrl clrcrl self-requested a review September 15, 2020 12:51
@clrcrl clrcrl merged commit ac432a1 into dbt-labs:dev/0.7.0 Sep 15, 2020
@joellabes joellabes deleted the test_accepted_range branch October 10, 2020 10:34
@yu-iskw
Copy link

yu-iskw commented Nov 17, 2020

Thank you for the great new feeature. I look forward to using it.
BTW, @clrcrl do you have a timeline to release dbt-utils==0.7.0?

@clrcrl
Copy link
Contributor

clrcrl commented Nov 18, 2020

We'll be doing utils 0.7.0 in line with dbt-core 0.19.0, which I think is coming up in mid-December.

In the meantime, you can either:
(a) install 0.7.0 by including this in your packages.yml:

packages:
- git: https://github.com/fishtown-analytics/dbt-utils.git
  revision: dev/0.7.0

(b) copying this macro into your own project (in the macros directory). Note, you won't need to prefix the test name with dbt_utils in that case.

FWIW, I'd go with (b), just in case we introduce a breaking change into this branch

@yu-iskw
Copy link

yu-iskw commented Dec 15, 2020

Thank you for sharing the knowledge. I will try it out.

@yu-iskw
Copy link

yu-iskw commented May 6, 2021

@clrcrl Please let me know when 0.7.0 is out, if you know. If there is any blocker and anything I can contribute to, please let me know as well. Thanks.

clrcrl pushed a commit that referenced this pull request May 18, 2021
Add integration tests

Add accepted_range documentation

Fixing invalid yaml in readme

Add missing columns: entry

Co-authored-by: Claire Carroll <[email protected]>

Update changelog
clrcrl pushed a commit that referenced this pull request May 18, 2021
Add integration tests

Add accepted_range documentation

Fixing invalid yaml in readme

Add missing columns: entry

Co-authored-by: Claire Carroll <[email protected]>

Update changelog
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 this pull request may close these issues.

3 participants