[Feature] Allow adapters to override unspecified values in unit tests
steffen030 opened this issue · comments
Is this your first time submitting a feature request?
- I have read the expectations for open source contributors
- I have searched the existing issues, and I could not find an existing issue for this feature
- I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
Describe the feature
The current unit testing implementation fills in null
s for unspecified values. This is however problematic for databases which have non-nullable datatypes, like Clickhouse, as a cast to null
will always trigger an error.
Therefore the adapter should be given the option to override the unspecified value depending on the datatype.
The lack of this feature currently blocks unit tests on Clickhouse adapter.
Describe alternatives you've considered
- Overriding
safe_cast()
macro could be an option. However, a safe cast is supposed to render values in doubt tonull
, which would not work well with non-nullable datatypes. Tampering with the macro just for the purpose of making it work for unit tests would interfere with other usages ofsafe_cast()
- An adapter could override the
get_fixture_sql()
macro. But it's not really intended to be overwritten by an adapter and it would be hard to maintain
Who will this benefit?
Any database that has not-nullable datatypes, like Clickhouse.
Are you interested in contributing this feature?
Sure.
Anything else?
Relates to this issue.