Skip to content
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] Allow adapters to override unspecified values in unit tests #10447

Open
3 tasks done
steffen030 opened this issue Jul 15, 2024 · 0 comments · May be fixed by dbt-labs/dbt-adapters#263
Open
3 tasks done

[Feature] Allow adapters to override unspecified values in unit tests #10447

steffen030 opened this issue Jul 15, 2024 · 0 comments · May be fixed by dbt-labs/dbt-adapters#263
Labels
enhancement New feature or request triage unit tests Issues related to built-in dbt unit testing functionality

Comments

@steffen030
Copy link

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 nulls 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 to null, 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 of safe_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.

@steffen030 steffen030 added enhancement New feature or request triage labels Jul 15, 2024
@dbeatty10 dbeatty10 added the unit tests Issues related to built-in dbt unit testing functionality label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage unit tests Issues related to built-in dbt unit testing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants