Add new functional_dependency
generic test macro
#988
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves #989
Problem
Currently, dbt-utils does not provide a built-in test to ensure that a set of columns (the “determinants”) functionally determines a single “dependent” column. This can be important for validating data integrity, for example, to confirm that every (order_id, product_id) maps to exactly one quantity.
Solution
Adds a new functional_dependency test under macros/generic_tests/.
This test checks that there is exactly one distinct dependent value for each unique combination of determinant columns.
Optionally allows filtering records via a where clause.
Includes example seed CSVs showing both passing and failing scenarios (test_functional_dependency_pass.csv and test_functional_dependency_fail.csv).
Adds a sample schema.yml demonstrating usage with data_tests, how to specify multiple determinant columns, and how to apply a custom where condition.
Provides documentation for the new test following dbt-utils conventions, describing arguments, usage patterns, and an example snippet similar to the style used in other generic tests.
Checklist