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

Fix foreign key constraints #789

Merged
merged 3 commits into from
Sep 16, 2024
Merged

Fix foreign key constraints #789

merged 3 commits into from
Sep 16, 2024

Conversation

benc-db
Copy link
Collaborator

@benc-db benc-db commented Sep 13, 2024

Resolves #784

Description

Looking into #784, constraints strip off config that dbt hasn't specified, so parent and parent_columns were not making it to the macro. It looks as though 'to' and 'to_columns' can fill this role instead. Will need to update any documentation out there that references parent and parent_columns.

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

@eric-wang-1990
Copy link
Collaborator

Need a little more context to understand, seems we are only changing what we expect the users to provide for the foreign key table and column. You mention parent and parent_columns are not working because of dbt will strip it out? Does to and to_columns work because that's a supported keyword by dbt? Any documents reference?

@benc-db
Copy link
Collaborator Author

benc-db commented Sep 16, 2024

Need a little more context to understand, seems we are only changing what we expect the users to provide for the foreign key table and column. You mention parent and parent_columns are not working because of dbt will strip it out? Does to and to_columns work because that's a supported keyword by dbt? Any documents reference?

Exactly. And no, these columns are not referenced in the docs I can find, but are public fields on the ModelConstraint class.

Copy link
Collaborator

@eric-wang-1990 eric-wang-1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a reference to the dbt feature in our changelog as of why we change to this?
dbt-labs/dbt-common@8edae92

@benc-db benc-db merged commit 8a2bb58 into main Sep 16, 2024
18 checks passed
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

Successfully merging this pull request may close these issues.

Foreign Key constraint error: No parent table defined for foreign key
2 participants