summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-11-03 03:37:44 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-11-03 03:37:44 +0000
commit47d2576365e60af6bfebad5761d8a81324538f6d (patch)
tree23bcbafb65825a62f55873661e5b8597c45121cc /lib/sqlalchemy
parenta5dfbeedb9f7ae148081d1dbc3e91e876526eb90 (diff)
downloadsqlalchemy-47d2576365e60af6bfebad5761d8a81324538f6d.tar.gz
- Fixed bug when using multiple query.join() with an aliased-bound
descriptor which would lose the left alias.
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/query.py14
-rw-r--r--lib/sqlalchemy/orm/util.py2
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index b358f4311..cad35972d 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -886,12 +886,14 @@ class Query(object):
if isinstance(onclause, sql.ClauseElement):
onclause = right_adapter.traverse(onclause)
- if prop:
- # MapperProperty based onclause
- onclause = prop
- else:
- # ClauseElement based onclause
- onclause = self._adapt_clause(onclause, False, True)
+ # TODO: is this a little hacky ?
+ if not isinstance(onclause, attributes.QueryableAttribute) or not isinstance(onclause.parententity, AliasedClass):
+ if prop:
+ # MapperProperty based onclause
+ onclause = prop
+ else:
+ # ClauseElement based onclause
+ onclause = self._adapt_clause(onclause, False, True)
clause = orm_join(clause, right_entity, onclause, isouter=outerjoin)
if alias_criterion:
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py
index fbc1acd5d..689df8d86 100644
--- a/lib/sqlalchemy/orm/util.py
+++ b/lib/sqlalchemy/orm/util.py
@@ -349,7 +349,7 @@ class _ORMJoin(expression.Join):
adapt_from = left
else:
adapt_from = None
-
+
right_mapper, right, right_is_aliased = _entity_info(right)
if right_is_aliased:
adapt_to = right