-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 configs #3392
New test configs #3392
Conversation
Git is terminally confused by this branch. Somehow a commit of mine (b952b70) seems to have gotten into this. I tried rebasing on develop because I like to look at a squashed commit to see all the changes and git couldn't do it. Could you make a clean branch and force push it? |
7c136b6
to
9e876cd
Compare
@gshank good call! Looks like I totally messed up a rebase at some point, should be in good shape now! |
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.
LGTM!
core/dbt/parser/schemas.py
Outdated
node.config['error_if'] = builder.error_if() | ||
if builder.fail_calc() is not None: | ||
node.unrendered_config['fail_calc'] = builder.fail_calc() | ||
node.config['fail_calc'] = builder.fail_calc() |
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'd prefer to see this in the builder as a method that just returns the configs. But we can leave that for later.
7da8c9f
to
1ed23b2
Compare
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.
lgtm!
Happy to merge #3316 before or after, in either case there will be some conflicts.
A few super minor details.. otherwise LGTM! |
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.
👍
cae0941
to
4157d02
Compare
Co-authored-by: Jeremy Cohen <[email protected]>
Co-authored-by: Jeremy Cohen <[email protected]>
4157d02
to
2adeb76
Compare
2adeb76
to
86637c8
Compare
* New test configs: where, limit, warn_if, error_if * update test task and tests * fix flake8 * Update core/dbt/parser/schemas.py Co-authored-by: Jeremy Cohen <[email protected]> * Update core/dbt/parser/schema_test_builders.py Co-authored-by: Jeremy Cohen <[email protected]> * respond to some feedback * add failures field * add failures to results * more feedback * add some test coverage * dev review feedback Co-authored-by: Jeremy Cohen <[email protected]> automatic commit by git-black, original commits: 2c40530
* New test configs: where, limit, warn_if, error_if * update test task and tests * fix flake8 * Update core/dbt/parser/schemas.py Co-authored-by: Jeremy Cohen <[email protected]> * Update core/dbt/parser/schema_test_builders.py Co-authored-by: Jeremy Cohen <[email protected]> * respond to some feedback * add failures field * add failures to results * more feedback * add some test coverage * dev review feedback Co-authored-by: Jeremy Cohen <[email protected]> automatic commit by git-black, original commits: 2388330 2c40530
reopened from #3336! (thanks @jtcohen6 )
resolves #3258, #3321
Description
Adds
fourfive new test configs:limit
: Simple enough, templated out in the materialization. This is mostly a complement for dbt test --store-failures #3316where
: The way I did this was unbelievably hacky—see the test cases for yourself—but it works, and in a way that should be backwards compatible with all existing schema/generic tests, without them needing to change any part of their SQL definition. (This config doesn't make sense for one-off tests.)warn_if
,error_if
: The user supplies a python-evaluable string (e.g.>=3
,<5
,==0
,!=0
) and dbt will compare the fail count/calc against it.!=0
severity
: A little tricky, but I actually think they work reasonably together. By default,severity: error
, and dbt checks theerror_if
condition first; if not error, then check thewarn_if
condition; if the result meets neither, it passes the test. If the user setsseverity: warn
, dbt will skip over theerror_if
condition entirely and jump straight towarn_if
.fail_calc
: User-supplied fail_calc for tests #3321Possible follow up work
where
logic in a special internal macro, so long as it's included in the schema test parsing context?Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.