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

[Feature] Allow adapters (or users?) to extend/reimplement materialization_enforces_constraints #10174

Open
3 tasks done
jtcohen6 opened this issue May 17, 2024 · 0 comments
Open
3 tasks done

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented May 17, 2024

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

@property
def materialization_enforces_constraints(self) -> bool:
return self.config.materialized in ["table", "incremental"]

This is hard-coded within dbt-core right now, which doesn't account for:

  • new materializations, e.g. materialized_view / dynamic_table
  • custom materializations (e.g. jercos_special_table) that might totally enforce constraints!

But it will be tricky because we're raising the warning at parsing time right now.

Two proposed options:

  • Move this check to execution time, and make it an adapter-overridable method (similar to adapter enforced/support checks for specific constraint types) or user-overridable macro
  • Turn this into a "negative" check, and raise it if a user has configured constraints on a view. If they're using a custom materialization, that's on them.

Describe alternatives you've considered

No response

Who will this benefit?

  • Adapter maintainers (@morsapaes)
  • Rollers of custom materializations

Are you interested in contributing this feature?

No response

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant