-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
When providing BOTH fixture and rows to unit test, rows silently ignored - instead throw an error #10357
Comments
Hi! When defining your input data using Additionally, Jinja is currently unsupported in SQL fixtures for unit tests. Similar issue here. |
Why should we limit this option when it has the potential to enhance the customizability of unit tests, as a testing framework should? Given that we already process a Jinja template with .sql (which is already supported by dbt unit-tests), it seems logical to also process the Jinja template with arguments. This could open up a new realm of flexibility. I believe this could be a significant shift towards customizable inputs, something the community has been seeking since the initial launch of 1.8.0.
I believe it would be advantageous to add support for Jinja. The ability to execute something like this would be highly beneficial:
This would undoubtedly increase the flexibility of input. However, please note that these are separate issues. Just to ensure we're on the same page and I've understood correctly, there are two options: Option 1: Using a SQL Jinja file, where jinja is already supported by dbt. I would ask to add support to receive arguments (through rows or params key). Option 2: Using inline SQL (without a file), in which case we don't currently support Jinja - so adding such support might be more complex. But in my opinion, the first option should be relatively straightforward to implement. However, please note that I attempted to create a pull request to implement option 1, but I have not been successful so far. |
Hi! Going to move the conversation on whether or not we should support jinja in SQL fixutre files over to the other issue you opened -> #10316 |
Is this a new bug in dbt-core?
Current Behavior
When setting both
rows:
andfixture:
for a single input in unit test definition, therows:
are silently ignored:Despite the rows being defined, the fixture does not recognize them and there are no error warnings.
Expected Behavior
We should throw an error when you set both
fixture:
androws:
in your unit test definition for a single input / expected output.Steps To Reproduce
Steps to Reproduce
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
No response
Additional Context
Workaround
A temporary solution was found by modifying the
compile_and_execute
function in the dbt-core base.py file as follows:This change resolves the issue and the fixture's SQL model starts rendering with parameters. However, a permanent solution in the form of a pull request has not been successful yet.
The text was updated successfully, but these errors were encountered: