databricks / dbt-databricks

A dbt adapter for Databricks.
https://databricks.com
Apache License 2.0
226 stars 119 forks source link

Fix foreign key constraints #789

Closed benc-db closed 2 months ago

benc-db commented 2 months ago

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

eric-wang-1990 commented 2 months ago

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 commented 2 months ago

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.