Closed leonardobocci closed 3 weeks ago
Thanks for raising this @leonardobocci !
I switched this from a bug report to a feature request since dbt is behaving the way we expect. Namely, for any columns that are not specified in a unit testing fixture, dbt takes that to mean the value doesn't matter and it will supply an arbitrary value to the transformation model. The default arbitrary value is null
, but some adapters may choose to override this default. If any value is relevant to your expected output (like filtercol
in your example!), then you'll need to supply it. dbt doesn't know which columns are important or not (and my initial guess is that it can't know).
Either way, we aren't planning to do anything fancier in this regard than we're doing currently, so I'm going to close this as "not planned".
Is this a new bug in dbt-core?
Current Behavior
Fixtures that are missing required columns in models lead to a hard-to-debug silent failure in the unit test.
Expected Behavior
When a dbt model requires a filtering column, unit tests should raise an error when fixtures don't contain the required columns.
Steps To Reproduce
bar as ( Transformations here )
select * from bar
unit_tests:
col1,col2 1,2 3,4
Relevant log output
Note: only expected output is expected, because due to the missing filtering column in the input fixture, no rows were selected.
Environment
Which database adapter are you using with dbt?
other (mention it in "Additional Context")
Additional Context
Adapter used: Clickhouse