Closed kjana-rv closed 2 years ago
Hi @kjana-rv, the dbt-init-testing framework had an issue with dbt version 1.3, it was fixed in release v0.2.2. Is this the release that you are using?
Hi, @psousa50 great question! I'm currently at dbt version 1.0 and dbt-unit-testing v0.2.0.
ok, so please upgrade to version v0.2.2 and try again. Thanks! π
That worked! I was able to test a success and failure case. The only other thing I haven't figured out is how to make the feedback more readable. I tried adding the output_sort_field
config option as per the README doc, but the feedback is still limited to displaying just that there was a row mismatch in the failure case. However, the code to get the row diffs can be found if I go to the execution details.
{% call dbt_unit_testing.test('int_address_entry_conversion',
'my test',
{"output_sort_field": "anonymous_id"}) %}
Thank you so much for your help! I'm happy to open another ticket for this if it is unrelated.
No worries, glad that I could help π I'm afraid I didn't quite understand your issue with the feedback, could you elaborate a bit more on that, please? Tx!
Sorry for any confusion; I misread the docs on Test Feedback and thought you had to pass the output_sort_field
as an option.
The issue I'm having is that the test feedback output seems to be incomplete; here's a screenshot:
I was expecting this result to show up in the log output right after Rows mismatch
with the differences against the defined records in dbt_unit_testing.expect()
:
which I was able to get by copying and running the generated query in the logs:
I haven't dived deep enough, but It looks like this function is not printing the output: https://github.com/EqualExperts/dbt-unit-testing/blob/33d5cc1762da9bc73828741fac26204333ed80be/macros/tests.sql#L127
Hope this helps!
Are you using dbt cloud? The print_table method is not supported on dbt could π
Yes, I am using DBT cloud. Are you aware if there is any limitation to supporting a similar function in DBT cloud? Happy to help research the topic.
I think we'll need to develop a similar function ourselves, but that's not an easy task when you think you have to do it in Jinja
Hi @kjana-rv, we just released v.0.2.3 with support for dbt cloud. Please try it and let us know if it works for you. Thank you!
@psousa50 it's been a while, but finally got to test the fix and it works! Thank you so much for the effort.
I created a unit test but I found that this line of code https://github.com/EqualExperts/dbt-unit-testing/blob/1733bdb798d927a6d7122d8e150bf44825e168f9/macros/sql_builders.sql#L21 does not seem to be rendering correctly when running:
dbt test --select tag:unit-test
Any ideas why this might be happening?
Copying below the compiled result, test, and DBT model:
Compiled result:
Test:
DBT Model (int_address_entry_conversion):