]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
rework wraps_column_expression logic to be purely compile time checking
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 16 Jun 2025 23:53:30 +0000 (19:53 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Jun 2025 14:31:31 +0000 (10:31 -0400)
commitc96805a43aa76bc3ec5134832a5050d527e432fe
tree1949c28b7a4738bf6b94ace4f1f1c4818169f180
parent8a287bf5c5635daf99217eb14d6957c22911d7bf
rework wraps_column_expression logic to be purely compile time checking

Fixed issue where :func:`.select` of a free-standing, unnamed scalar expression that
has a unary operator applied, such as negation, would not apply result
processors to the selected column even though the correct type remains in
place for the unary expression.

This change opened up a typing rabbithole where we were led to also
improve and harden the typing for the Exists element, in particular
in that the Exists now always refers to a ScalarSelect object, and
no longer a SelectStatementGrouping within the _regroup() cases; there
did not seem to be any reason for this inconsistency.

Fixes: #12681
Change-Id: If9131807941030c627ab31ede4ccbd86e44e707f
doc/build/changelog/unreleased_20/12681.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/testing/assertions.py
test/sql/test_labels.py
test/sql/test_operators.py
test/sql/test_selectable.py
test/sql/test_types.py