summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/context.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-10-26 22:59:51 -0400
committermike bayer <mike_mp@zzzcomputing.com>2022-10-28 16:09:20 +0000
commit28541188aedb4074facc230a8d270be62c70bcce (patch)
treee27b441965000728ad5e608e5abe7305b4ca8aa4 /lib/sqlalchemy/orm/context.py
parent2dc05f0c35f1b23168e65414d05ab275b0914f38 (diff)
downloadsqlalchemy-28541188aedb4074facc230a8d270be62c70bcce.tar.gz
ensure _ORMJoin transfers parententity from left side
Fixed bug involving :class:`.Select` constructs which used a combination of :meth:`.Select.select_from` with an ORM entity followed by :meth:`.Select.join` against the entity sent in :meth:`.Select.select_from`, as well as using plain :meth:`.Select.join_from`, which when combined with a columns clause that didn't explicitly include that entity would then cause "automatic WHERE criteria" features such as the IN expression required for a single-table inheritance subclass, as well as the criteria set up by the :func:`_orm.with_loader_criteria` option, to not be rendered for that entity. The correct entity is now transferred to the :class:`.Join` object that's generated internally, so that the criteria against the left side entity is correctly added. Fixes: #8721 Change-Id: I8266430063e2c72071b7262fdd5ec5079fbcba3e
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r--lib/sqlalchemy/orm/context.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py
index f8c7ba714..8dca83756 100644
--- a/lib/sqlalchemy/orm/context.py
+++ b/lib/sqlalchemy/orm/context.py
@@ -2246,6 +2246,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
for fromclause in self.from_clauses:
ext_info = fromclause._annotations.get("parententity", None)
+
if (
ext_info
and (