-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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-2199] Generalize constraint compatibility warnings #7067
Comments
Adapter-specific supportThe default implementation of this method should be the one shown in the description above. This should hold true for
For
For
For
This method doesn't include anything for the |
Is there any need to distinguish "supported/enforced on a column" from "supported/enforced on a model" for the purposes of this case, or is that reliably a none-or-both proposition across databases? |
Good thought! It's reliably a none-or-both proposition. (When I first read your question, I thought it was asking something slightly different: Are there any constraints that cannot be defined at both column & model level? The answer there is "yes," |
If specified, a |
Refinement discussion: #6750
Currently, constraints that are set but unenforceable or unsupported raise warnings in adapter-specific jinja macros. For example:
snowflake__get_columns_spec_ddl
in dbt-snowflake.To generalize this warning mechanism, we'll need a new adapter method that can tell dbt whether a constraint is:
Here's what that might look like for
dbt-snowflake
, in pseudo code:This mapping could be a static method, or a property, or maybe just a constant class attribute. As long as subclasses of
BaseAdapters
are able to overwrite it. This mapping should also not be available in the jinja context as it's intended for use within the python adapter implementation and not by end users in user space (jinja).This method would be called in order to determine whether to raise warnings for unenforced/unsupported constraints (unless the user has disabled via
warn_unsupported
orwarn_unenforced
(#7066)). Ideally, warnings would be raised at runtime - during materialization, for legible user-facing logs. The actual method that raises warnings could also be implemented in python, on the adapter, callingwarn_or_error
and firing an event under the hood. It should be used to replace the existing adapter-specific warning mechanisms.The
constraint_support
method should be implemented for each adapter, but the warning implementation should be generalized and only implemented in dbt-core.Is blocked by:
Blocks:
The text was updated successfully, but these errors were encountered: