Hey I want to implement a test to verify if the `u...
# community-support
o
Hey I want to implement a test to verify if the
user_kind
field matches between two tables,
users_all
and
users
, based on the
user_id
. This test should generate a warning in case of any mismatches. Could you guide me on what steps to take or configurations to add for this purpose? At the moment, our test is set up to verify if the two distinct values of 'user_kind' are present in both the 'users_all' and 'users' tables. However, I would like to modify the test to ensure that a specific 'user_id' (for example, 'user_id' 1234) has the same 'user_kind' value in both tables. Thank you. @Shay Misgav
Copy code
- name: user_kind
        tests:
          - not_null
          - accepted_values:
              values: [ 'user', 'employee' ]
              config:
                severity: warn
          - relationships:
              to: ref('users_all')
              field: user_kind
              config:
                severity: warn
✅ 1
👽 1
s
I'm not sure elementary is the best option here. dbt_utils has a test called equality that uses set operators to achieve something similar
✅ 1
👑 1
may or may not work for your use case
✅ 1
if not, you may need to create your own singular or generic test; you could modify the code for the default relationships test pretty easily to get what you're looking for
✅ 1