Open JCZuurmond opened 2 years ago
what happened with this one?
@megetron3 : I opened this issue to receive feedback from users on this feature. You can add a thumbs up on the first comment to signal your interest.
Currently, the package is lightweight and worked with new dbt releases with minimal/no changes making maintaining the package low time consuming. However, the functionality is also limited.
dbt Labs announced adding unit testing capabilities to dbt-core
. I am not up-to-date with the status. I prefer they supporting unit testing over this package supporting unit testing.
This does not stop us from adding unit testing to this package, though, I want to do it with careful consideration. Would you be interested in adding this feature?
@JCZuurmond, I appreciate your response. Upon thorough reading, it appears that the new unit-testing feature introduced by dbt-core utilizes YAML syntax. While it may be a viable option for unit testing, it's evident that pytest and Python offer distinct capabilities, which differ from the YAML syntax and the capabilities of dbt.
I believe employing pure Python for testing dbt models could serve as a valuable alternative.
Hi @megetron3, I agree with you on pure Python testing being a valuable alternative. That is the reason that I created this package.
Currently I don't have the time to implement this feature. I would be open to supporting someone who wants to implement this.
Thanks for your interaction on this issue. It motivates to know if users are interested in this functionality
The following resource might be helpful with implementing this feature: https://github.com/sqlfluff/sqlfluff/blob/main/plugins/sqlfluff-templater-dbt/sqlfluff_templater_dbt/templater.py
Is this your first time opening an issue?
Describe the Feature
Support unit testing models. Most likely we need another fixture to fetch a model, then similar to a macro, we use that fixture in a test.
To consider:
ref
andsource
. How do we handle this? Could we for example mock them? If so, can we share mocks across tests.Describe alternatives you've considered
Not unit testing models, stick to unit testing macros. You can put the complex SQL - or all SQL - in (modular) macros, then test those. This is not user friendly though.
Who will this benefit?
Those who want to test models, not just macros
Are you interested in contributing this feature?
Yes
Anything else?
See discussion on this topic in the dbt-core repo