Skip to content

chore: simplify render_column_constraint - #825

Merged
axellpadilla merged 1 commit into
dbt-msft:masterfrom
joshmarkovic:jm/simplify-render-column-constraint
Aug 26, 2026
Merged

chore: simplify render_column_constraint#825
axellpadilla merged 1 commit into
dbt-msft:masterfrom
joshmarkovic:jm/simplify-render-column-constraint

Conversation

@joshmarkovic

Copy link
Copy Markdown
Contributor

What

render_column_constraint built 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 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.

The method also had a dead rendered_column_constraint = None that was overwritten on the next line.

Behaviour

Unchanged. not_null returns not null and every other constraint type returns an empty string, exactly as before. The generated column DDL is identical, including the trailing space that the fixtures in tests/functional/adapter/dbt/test_constraints.py expect.

No changelog entry, since nothing user-facing changes.

Testing

ruff check, ruff format --check, ty check and the 500 unit tests all pass. Pre-commit passes on the commit.

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
joshmarkovic marked this pull request as ready for review August 25, 2026 14:51
@axellpadilla
axellpadilla merged commit 521ea20 into dbt-msft:master Aug 26, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants