-
Notifications
You must be signed in to change notification settings - Fork 79
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
Expect empty resultset #173
Comments
Hi @darian-heede, we can implement that; it makes perfect sense. Meanwhile, you can use something like this to test an empty result set: {% call dbt_unit_testing.mock_ref ('some_model') %}
select 1 where false
{% endcall %} Let me know if it works for you. Thank you! |
Hi @psousa50 , thank you for your reply! Creating an empty mock ref makes sense and will work, but how do you use it to expect an empty resultset? Using {% call dbt_unit_testing.expect() %}
SELECT 1 WHERE FALSE
{% endcall %} will return the |
For me, it works when you specify the column names, even if the query will return empty
ps: I'm using dbt with automate-dv package |
Please take a look at the latest release (0.4.0) and check if it fixes this issue. Thank you! |
Hi @psousa50, I tested |
I got the following error when trying to use For those who are having this issue but haven't been able to update versions I found a workaround: You may have to replace |
Is there a way to expect no return values, i.e. an empty resultset? Leaving the
dbt_unit_testing.expect()
call empty will yield acan't execute an empty query
error.It would be great to be able to call
dbt_unit_testing.expect_nothing()
for such cases.Another solution would be to be able to specify the expected row count to be returned, which might also be useful for other use cases as well and could solve this issue by expecting 0 rows returned.
The text was updated successfully, but these errors were encountered: