-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Feature] Unit testing models #12
Comments
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 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
The text was updated successfully, but these errors were encountered: