]> 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 02:31:24 +0000 (21:31 -0500)
commite3710b405ff2680bf67c0eb0cf91182f9094237d
treeb068477cbb5986831040497b10ded72c354e6978
parentdf3bd8d29740e846d7faac842a6e2de16cf483f0
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
doc/build/changelog/unreleased_14/8881.rst [new file with mode: 0644]
lib/sqlalchemy/orm/_orm_constructors.py
lib/sqlalchemy/orm/properties.py
test/orm/test_core_compilation.py
test/orm/test_deferred.py