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

[CT-2223] [Spark] Add model-level constraints to get_columns_spec_ddl #657

Closed
Tracked by #6747
MichelleArk opened this issue Feb 28, 2023 · 0 comments · Fixed by #747
Closed
Tracked by #6747

[CT-2223] [Spark] Add model-level constraints to get_columns_spec_ddl #657

MichelleArk opened this issue Feb 28, 2023 · 0 comments · Fixed by #747
Assignees

Comments

@MichelleArk
Copy link
Contributor

Core issue: dbt-labs/dbt-core#6754

from dbt-labs/dbt-core#7067:

constraint type support
not_null not enforced
primary_key not enforced
foreign_key not enforced
unique not enforced
check not enforced

Spark only supports check constraints at the table-level. Add check constraints set at the model-level after check constraints from columns are added: https://github.com/dbt-labs/dbt-spark/blob/main/dbt/include/spark/macros/adapters.sql#L200

Testing coverage is tricky here because the alter statements run after the create table statement: https://github.com/dbt-labs/dbt-spark/blob/main/tests/functional/adapter/test_constraints.py#L8

Constraint docs: https://docs.delta.io/latest/delta-constraints.html

@github-actions github-actions bot changed the title [Spark] Add model-level constraints to get_columns_spec_ddl [CT-2223] [Spark] Add model-level constraints to get_columns_spec_ddl Feb 28, 2023
@mikealfare mikealfare self-assigned this Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants