dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.25k stars 1.53k forks source link

[Bug] Unit test fixture null values cause typing issues #10365

Open VersusFacit opened 3 days ago

VersusFacit commented 3 days ago

Is this a new bug in dbt-core?

Current Behavior

Unit test fixtures are parsed correctly, but they leave typing up to the target database. This will result in unhandled database failures when there is no one row Null free (this handles indirectly the all values in a column Null failure case). The database won't be able to determine which type to use and default to something like VARCHAR(1) which may not be what the source table expects -- this leads to a type failure.

This change is motivated by a redshift change but could affect other adapters some day.

Expected Behavior

Let's sort this to give fixtures the best chance to succeed or in unwinnable situations, error out with a known exception.

Steps To Reproduce

See reprex here

Relevant log output

No response

Environment

- OS:
- Python:
- dbt:

Which database adapter are you using with dbt?

redshift

Additional Context

See redshift PR here