chore: simplify render_column_constraint - #825
Merged
axellpadilla merged 1 commit intoAug 26, 2026
Merged
Conversation
The method built "not null " with a trailing space, then stripped the
space back off. Both halves are left over from dbt-core's base method,
which builds f"not null {constraint_expression}" and strips the trailing
space when there is no expression. This override dropped the
interpolation but kept the space and the strip, so neither did anything.
Return values are unchanged for every constraint type, including the
trailing separator space the constraint fixtures expect.
joshmarkovic
marked this pull request as ready for review
August 25, 2026 14:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
render_column_constraintbuilt the string"not null "with a trailing space, then stripped the space back off. It now returns the value directly.Why
Both the space and the
.strip()are left over from dbt-core's base method, which buildsf"not null {constraint_expression}"and strips the trailing space when there is no expression. This override dropped the interpolation but kept the space and the strip, so neither did anything.The method also had a dead
rendered_column_constraint = Nonethat was overwritten on the next line.Behaviour
Unchanged.
not_nullreturnsnot nulland every other constraint type returns an empty string, exactly as before. The generated column DDL is identical, including the trailing space that the fixtures intests/functional/adapter/dbt/test_constraints.pyexpect.No changelog entry, since nothing user-facing changes.
Testing
ruff check,ruff format --check,ty checkand the 500 unit tests all pass. Pre-commit passes on the commit.