From 8ac2bec0292daaefdfd4062a209ae4c44ba6d690 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 2 May 2015 11:33:54 -0400 Subject: - Liberalized an assertion that was added as part of :ticket:`3347` to protect against unknown conditions when splicing inner joins together within joined eager loads with ``innerjoin=True``; if some of the joins use a "secondary" table, the assertion needs to unwrap further joins in order to pass. fixes #3412 --- lib/sqlalchemy/orm/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index b9098c77c..823b97239 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -849,7 +849,11 @@ class _ORMJoin(expression.Join): Given join(a, b) and join(b, c), return join(a, b).join(c) """ - assert self.right is other.left + leftmost = other + while isinstance(leftmost, sql.Join): + leftmost = leftmost.left + + assert self.right is leftmost left = _ORMJoin( self.left, other.left, -- cgit v1.2.1