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

update for generalized constraint warnings #551

Merged
merged 5 commits into from
Apr 11, 2023

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented Apr 4, 2023

resolves #492

Description

Uses centralized warnings from dbt-core for constraints.

Checklist

@cla-bot cla-bot bot added the cla:yes label Apr 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2023

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-snowflake contributing guide.

@emmyoop emmyoop added the Skip Changelog Skips GHA to check for changelog file label Apr 4, 2023
@emmyoop emmyoop force-pushed the er/CT-2216-generalize-warnings branch from 5d2aaef to 2718430 Compare April 11, 2023 18:43
@emmyoop emmyoop marked this pull request as ready for review April 11, 2023 18:43
@emmyoop emmyoop requested a review from a team as a code owner April 11, 2023 18:43
@emmyoop emmyoop requested a review from mikealfare April 11, 2023 18:55

@classmethod
def render_column_constraint(cls, constraint: ColumnLevelConstraint) -> str:
if constraint.type == ConstraintType.check:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is over-engineering it, but can we use CONSTRAINT_SUPPORT? So this:

if self.CONSTRAINT_SUPPORT[constraint.type] == ConstraintSupport.NON_SUPPORTED:
    return ""
return super().render_column_constraint(constraint)

For that matter, can we just put this in dbt-core? Then we wouldn't need to override this method at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not exactly sure what you mean by override – it seems that they're removing these methods entirely right?

Copy link
Contributor

Choose a reason for hiding this comment

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

We did, and we also did what Mike suggested, but in the base adapter, so that everyone can enjoy.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't read so gud

Copy link
Contributor

Choose a reason for hiding this comment

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

Apparently if you stare at code long enough, you forget what red/green and left/right mean.

return super().render_column_constraint(constraint)

@classmethod
def render_model_constraint(cls, constraint: ModelLevelConstraint) -> Optional[str]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor

@VersusFacit VersusFacit left a comment

Choose a reason for hiding this comment

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

Assuming I'm reading my comment correctly and that we are in fact good to go


@classmethod
def render_column_constraint(cls, constraint: ColumnLevelConstraint) -> str:
if constraint.type == ConstraintType.check:
Copy link
Contributor

Choose a reason for hiding this comment

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

We did, and we also did what Mike suggested, but in the base adapter, so that everyone can enjoy.

@emmyoop emmyoop merged commit 9458c57 into main Apr 11, 2023
@emmyoop emmyoop deleted the er/CT-2216-generalize-warnings branch April 11, 2023 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2216] [Snowflake] Remove constraints_check warning in get_columns_spec_ddl
4 participants