]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
improve column targeting issues with query_expression
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 25 Nov 2022 21:49:28 +0000 (16:49 -0500)
committermike bayer <mike_mp@zzzcomputing.com>
Sat, 26 Nov 2022 15:15:04 +0000 (15:15 +0000)
commit93afb76519380bb86fe5ecf62e75ddfd62c337e4
treef13858bf8d08190f265e16ea904d77b28a020406
parentf4cf0f93f4bc1cbb5dc3ba2ed7a7f43a575e6d91
improve column targeting issues with query_expression

Fixed issues in :func:`_orm.with_expression` where expressions that were
composed of columns within a subquery being SELECTed from, or when using
``.from_statement()``, would not render correct SQL **if** the expression
had a label name that matched the attribute which used
:func:`_orm.query_expression`, even when :func:`_orm.query_expression` had
no default expression. For the moment, if the :func:`_orm.query_expression`
**does** have a default expression, that label name is still used for that
default, and an additional label with the same name will be ignored.
Overall, this case is pretty thorny so further adjustments might be
warranted.

Fixes: #8881
Change-Id: Ie939b1470cb2e824717384be65f4cd8edd619942
(cherry picked from commit 474326e87038f997fb9423c56379b8ba19a5e43b)
doc/build/changelog/unreleased_14/8881.rst [new file with mode: 0644]
lib/sqlalchemy/orm/properties.py
test/orm/test_core_compilation.py
test/orm/test_deferred.py