Skip to content

Commit

Permalink
Merge "Ignore newlines in expressions for Computed" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzeek authored and Gerrit Code Review committed Jan 15, 2024
2 parents 2d60c77 + 06aee70 commit 798f82d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion alembic/autogenerate/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ def _normalize_computed_default(sqltext: str) -> str:
"""

return re.sub(r"[ \(\)'\"`\[\]]", "", sqltext).lower()
return re.sub(r"[ \(\)'\"`\[\]\t\r\n]", "", sqltext).lower()


def _compare_computed_default(
Expand Down
1 change: 1 addition & 0 deletions alembic/testing/suite/test_autogen_computed.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def test_cant_change_computed_warning(self, test_case):
lambda: (None, None),
lambda: (sa.Computed("5"), sa.Computed("5")),
lambda: (sa.Computed("bar*5"), sa.Computed("bar*5")),
lambda: (sa.Computed("bar*5"), sa.Computed("bar * \r\n\t5")),
(
lambda: (sa.Computed("bar*5"), None),
config.requirements.computed_doesnt_reflect_as_server_default,
Expand Down
6 changes: 6 additions & 0 deletions docs/build/unreleased/1391.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. change::
:tags: usecase, autogenerate
:tickets: 1391

Improve computed column compare function to support multi-line expressions.
Pull request courtesy of Georg Wicke-Arndt.

0 comments on commit 798f82d

Please sign in to comment.