From 2c7eb1f7dd20059ab74081947676a0e3389f3464 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 18 Mar 2021 17:46:24 -0400 Subject: repair legacy_last_joined_entity for no onclause Fixed regression where the :meth:`_orm.Query.filter_by` method would fail to locate the correct source entity if the :meth:`_orm.Query.join` method had been used targeting an entity without any kind of ON clause. Fixes: #6092 Change-Id: I38d9099844f842f314c6673bd922467242409cdb --- lib/sqlalchemy/orm/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/orm/context.py') diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index 9cfa0fdc6..45ab64593 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -2136,7 +2136,7 @@ def _legacy_determine_last_joined_entity(setup_joins, entity_zero): if right is not None and "parententity" in right._annotations: right = right._annotations["parententity"].entity - if onclause is not None and right is not None: + if right is not None: last_entity = right insp = inspect(last_entity) if insp.is_clause_element or insp.is_aliased_class or insp.is_mapper: -- cgit v1.2.1