summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-10-25 18:04:59 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-10-25 18:04:59 +0000
commite82eebb368718ba1fe24853373399f0fbd2c17e4 (patch)
treed1664d6cce3b78bdbce4c7fd63fd67920a7cda14 /test
parentaf1bb6b95553db49af2dc2aa73b75a24b752c6bc (diff)
downloadsqlalchemy-e82eebb368718ba1fe24853373399f0fbd2c17e4.tar.gz
- When using Query.join() with an explicit clause for the
ON clause, the clause will be aliased in terms of the left side of the join, allowing scenarios like query(Source). from_self().join((Dest, Source.id==Dest.source_id)) to work properly.
Diffstat (limited to 'test')
-rw-r--r--test/orm/query.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/orm/query.py b/test/orm/query.py
index 567ca317c..db709200b 100644
--- a/test/orm/query.py
+++ b/test/orm/query.py
@@ -976,6 +976,24 @@ class JoinTest(QueryTest):
[('jack',)]
)
+ # explicit onclause with from_self(), means
+ # the onclause must be aliased against the query's custom
+ # FROM object
+ self.assertEquals(
+ sess.query(User).offset(2).from_self().join(
+ (Order, User.id==Order.user_id)
+ ).all(),
+ [User(name='fred')]
+ )
+
+ # same with an explicit select_from()
+ self.assertEquals(
+ sess.query(User).select_from(select([users]).offset(2).alias()).join(
+ (Order, User.id==Order.user_id)
+ ).all(),
+ [User(name='fred')]
+ )
+
def test_aliased_classes(self):
sess = create_session()