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

Adapter constraint support tables #3944

Merged
merged 8 commits into from
Aug 21, 2023
Merged

Conversation

matthewshaver
Copy link
Contributor

@matthewshaver matthewshaver commented Aug 17, 2023

Preview

What are you changing in this pull request and why?

Adding tables outlining adapter-specific constraint support to the model contracts page

Checklist

  • Review the Content style guide and About versioning so my content adheres to these guidelines.
  • Add a checklist item for anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch."

@matthewshaver matthewshaver requested a review from a team as a code owner August 17, 2023 15:44
@netlify
Copy link

netlify bot commented Aug 17, 2023

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit 17d98d7
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/64e3b8ef20a30b00081e0737
😎 Deploy Preview https://deploy-preview-3944--docs-getdbt-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: medium This change will take up to a week to address and removed Docs team Authored by the Docs team @dbt Labs labels Aug 17, 2023
Copy link
Contributor

@mirnawong1 mirnawong1 left a comment

Choose a reason for hiding this comment

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

hey @matthewshaver , looks awesome and i left some suggestions! do you think you should link to the #platform-constraint-support in the 'what are contracts supported' section? (also 'what are contracts supported' sounds a bit weird)

Screenshot 2023-08-17 at 12 15 08

Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

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

@matthewshaver I double-checked the constraints support within this PR against all of these:

Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

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

@matthewshaver and @mirnawong1

In order to figure out the best language to use in the tables, see below for some explanations. "supported; not enforced" seems to be the most tricky one to explain and understand.

If we change the verbiage, it seems that "supported but not enforced" would be better than "supported and not enforced".

🌕 supported & enforced

The model won't even build if it violates this constraint.

🌗 supported; not enforced

The platform supports specifying this type of constraint, but a model can still build even if it violates it. It's basically a "fake" constraint only for metadata purposes. This is common for modern cloud data warehouses and less common for legacy databases.

🌑 not supported

You can't specify this type of constraint for this platform.

@mirnawong1
Copy link
Contributor

@matthewshaver and @mirnawong1

In order to figure out the best language to use in the tables, see below for some explanations. "supported; not enforced" seems to be the most tricky one to explain and understand.

If we change the verbiage, it seems that "supported but not enforced" would be better than "supported and not enforced".

🌕 supported & enforced

The model won't even build if it violates this constraint.

🌗 supported; not enforced

The platform supports specifying this type of constraint, but a model can still build even if it violates it. It's basically a "fake" constraint only for metadata purposes. This is common for modern cloud data warehouses and less common for legacy databases.

🌑 not supported

You can't specify this type of constraint for this platform.

that's awesome,i think it would be really helpful to add those definitions so users know what they mean, just to be extra clear. i had to scroll back and forth to try to get my bearings so maybe having it clear before the table is helpful for users.

i like support but not enforced!

Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

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

@matthewshaver and @mirnawong1

Would an alternative like this be more clear?

constraint type platform support platform enforcement
not_null ✅ supported ✅ enforced
primary_key ✅ supported ❌ not enforced
foreign_key ✅ supported ❌ not enforced
unique ✅ supported ❌ not enforced
check ❌ not supported ❌ not enforced

Rather than this?

constraint type support
not_null 🌕 supported & enforced
primary_key 🌗 supported; not enforced
foreign_key 🌗 supported; not enforced
unique 🌗 supported; not enforced
check 🌑 not supported

@mirnawong1
Copy link
Contributor

yep i prefer that @dbeatty10 ! i was going to suggest changing the table but i didn't want to mess anything going on between yall. separating them out is clearer!

i still think having a paragraph explaining what supported and enforced or not enforced means in this context is helpful -- just to be super clear with users.

@github-actions github-actions bot added the Docs team Authored by the Docs team @dbt Labs label Aug 17, 2023
@matthewshaver
Copy link
Contributor Author

@dbeatty10 Thank you for that context - much clearer and that makes the tables easier to follow. Will implement.

Copy link
Collaborator

@runleonarun runleonarun left a comment

Choose a reason for hiding this comment

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

@matthewshaver Just some wording suggestions to simplify the sentences a little

website/docs/docs/collaborate/govern/model-contracts.md Outdated Show resolved Hide resolved
website/docs/docs/collaborate/govern/model-contracts.md Outdated Show resolved Hide resolved
website/docs/docs/collaborate/govern/model-contracts.md Outdated Show resolved Hide resolved
website/docs/docs/collaborate/govern/model-contracts.md Outdated Show resolved Hide resolved
@matthewshaver matthewshaver merged commit 344f794 into current Aug 21, 2023
10 checks passed
@matthewshaver matthewshaver deleted the contract-constraints branch August 21, 2023 19:28
</TabItem>
<TabItem value="Spark" label="Spark">

Currently, `not_null` and `check` constraints are supported and enforced only after a model builds. Because of this platform limitation, dbt considers these constraints `supported` but `not enforced`, which means they're not part of the "model contract" since these constraints can't be enforced at build time. This table will change as the features evolve.
Copy link
Contributor

Choose a reason for hiding this comment

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

Like the identical Databricks copy below, this paragraph is confusing.

I'd suggest rewriting for more clarity, potentially like the following:

Currently, not_null and check constraints are applied only after a model builds. Because of this platform limitation, dbt considers these constraints supported but not enforced, which means they're not part of the "model contract" since these constraints can't be enforced at build time. This table will change as the features evolve.

</TabItem>
<TabItem value="Databricks" label="Databricks">

Currently, `not_null` and `check` constraints are supported and enforced only after a model builds. Because of this platform limitation, dbt considers these constraints `supported` but `not enforced`, which means they're not part of the "model contract" since these constraints can't be enforced at build time. This table will change as the features evolve.
Copy link
Contributor

Choose a reason for hiding this comment

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

Like the identical Spark copy above, this paragraph is confusing.

I'd suggest rewriting for more clarity, potentially like the following:

Currently, not_null and check constraints are applied only after a model builds. Because of this platform limitation, dbt considers these constraints supported but not enforced, which means they're not part of the "model contract" since these constraints can't be enforced at build time. This table will change as the features evolve.

Comment on lines +93 to +95
- **Supported and enforced** &mdash; The model won't build if it violates the constraint.
- **Supported and not enforced** &mdash; The platform supports specifying the type of constraint, but a model can still build even if building the model violates the constraint. This constraint exists for metadata purposes only. This is common for modern cloud data warehouses and less common for legacy databases.
- **Not supported and not enforced** &mdash; You can't specify the type of constraint for the platform.
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice if the bolded descriptions were more readable. Right now, the last one feels too verbose and the middle one could be more precise.

Would the following in conjunction with the split columns be clear enough?

  • Enforced or Supported and enforced or Supported & enforced
  • Supported (but not enforced) or Supported but not enforced or Supported; not enforced
  • Not supported or Not supported (and not enforced)

#3944 (review) begins the original discussion about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: medium This change will take up to a week to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Model contracts: matrix showing which constraints are supported/enforced by data warehouse
4 participants