Hi there,
I’m a newbie to this tool. With what i’ve read and tested so-far I was under the false impression of what the ‘relationships’ method of the testing feature does.
I’ve set relationships between tables and when I run the test command those tests are successful (i.e PASS). However, for those tables in the data warehouse i’m developing as of now, there are no PK/FK constraints - I have defined that in postgres myself or figured out where to define that within the models schema.
- What does the dbt-tool actually check for in the case of ‘relationships’?
- Where would I define the PK/FK constraints within the model? Have not seen documentation about this, possibly missed that part.
Short snippet of the schema.yml:
version: 2
models:
- name: customers
description: A table containing all customers
columns:
- name: uid
description: This is a unique identifier in the customer
tests:
# - unique
- not_null
- name: suppliers
description: This is a unique identifier in the supplier table
tests:
- not_null
- relationships:
to: ref(‘customers’)
field: uid
Thanks in advance!