-
Notifications
You must be signed in to change notification settings - Fork 975
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
dbt-bigquery supports and enforces primary key constraints #4419
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Primary (and foreign) keys are supported but not enforced in BQ, so I think you only want the first change |
Thank you! Appreciate you pointing out that in BigQuery Key Constraints are not enforced and are only so the query optimizer may use this information to better optimize queries. As such, users will need to have testing in place to ensure primary key fields are unique and not null. Our source code is currently asserting that they are enforced (?!), so I've reached out to our engineering team for clarification. Guessing that we'll want to update the source code to be this instead: ConstraintType.primary_key: ConstraintSupport.NOT_ENFORCED,
ConstraintType.foreign_key: ConstraintSupport.NOT_ENFORCED, Once that clarification comes in, will try to update all the different documentation pages and source code so that they are all in alignment. |
ah interesting, they most definitely are not 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm and preview looks right!
Previews
What are you changing in this pull request and why?
@bnaul called out here that some documentation isn't in alignment with the source code (which asserts that dbt-bigquery supports and enforces primary key constraints).
Here are some other docs that should all be in alignment, but aren't:
Model contracts: Platform constraint support
https://docs.getdbt.com/docs/collaborate/govern/model-contracts#platform-constraint-support
constraints: Platform-specific support
https://docs.getdbt.com/reference/resource-properties/constraints#platform-specific-support
Checklist