Show unexpected values when accepted_values test fails
See original GitHub issueWhen an accepted_values
test fails, print the unexpected values.
I am currently writing a test against a column with many possible values, where we want to know if any new values appear in the column that might affect our analytics.
When the accepted_values
test fails, it shows a message like:
Got N results, expected 0.
However, it doesn’t display information about the unexpected results
Showing the unexpected results would make it easier to investigate and modify the test.
I can help contribute to this feature.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Show unexpected values when accepted_values test fails
When an accepted_values test fails, print the unexpected values. I am currently writing a test against a column with many possible values, ...
Read more >vue component emits unexpected value when testing with ...
I have a BaseCheckbox component that renders a checkbox, using a "value" prop. When I click on the tag, the component emits event.target.checked ......
Read more >7 dbt Testing Best Practices
1. not_null: A null value in data indicates that a value in a column is missing or unknown. Sometimes, null values are intentional...
Read more >Error codes
The account ID provided as a value for the Stripe-Account header is invalid. Check that your requests are specifying a valid account ID....
Read more >Error 'bad value for restricted picklist field' appears when a ...
Cause of the 'Bad Value' error · The referenced picklist field has 'Restrict picklist to the values defined in the value set' set...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think this imagines us rewriting the default
accepted_values
test to be:@brylie What a cool idea! I think that the requisite pieces may just be falling into place, so that we could make this happen.
Back in #2593, I made a detailed proposal for how tests could store their (failing) results in database tables. To date, each schema test query has returned a single numeric value—
count(*)
or whatever else—so it would have been impossible to save and present an actual table of failing values. In order to make that happen, we’ve been working on creating a standard test “materialization” (#3181), and implementing it for ~schema~ generic tests as well (#3192). Those generic tests will now return a set of rows—whether that’s simply rows from the table where a column is null, or rows from an aggregate query that rolls up counts by unacceptable values.All of which is to say, if we’re doing all that and can save those results in a database table, in addition to grabbing the total failure count/value, we could also print a few of those results to stdout using good old
results.print_table()
:I think we’d put in limitations like:
order_by
(in the case above,order by 2 desc
)Let me know what you think about the above, and let’s see if we can sneak in this (or something like it) alongside the other test functionality coming in v0.20.0 😃