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

Constraint application of primary and foreign keys #47

Open
matinnuhamunada opened this issue Feb 28, 2023 · 0 comments
Open

Constraint application of primary and foreign keys #47

matinnuhamunada opened this issue Feb 28, 2023 · 0 comments

Comments

@matinnuhamunada
Copy link

Hi, I'm quite new to DBT and DuckDB. I'm still a bit confused about setting up primary and foreign keys in the models.

I saw that this is how it is being implemented in the models:

- name: order_id
tests:
- unique
- not_null
description: This is a unique identifier for an order
- name: customer_id
description: Foreign key to the customers table
tests:
- not_null
- relationships:
to: ref('customers')
field: customer_id

When I open the resulting .db file in DBeaver or Metabase, the constraints doesn't seem to be implemented.

My question is:

  • Is this something that is expected in DBT or am I missing something?
  • Why don't we implement this in the .sql scripts?

PS:
I also found these tools:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant