diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-12 15:19:09 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-12 15:19:09 +0000 |
| commit | 6d01d962290bb3f3973f37c61ee489ca1d94f515 (patch) | |
| tree | 6d053ba8dba9a28a94199aa475bbced23f9a7191 /test | |
| parent | 7897dd9827ac62db973fcac0e04b1b9bb26709e1 (diff) | |
| download | sqlalchemy-6d01d962290bb3f3973f37c61ee489ca1d94f515.tar.gz | |
- Improved the behavior of query.join()
when joining to joined-table inheritance
subclasses, using explicit join criteria
(i.e. not on a relation).
Diffstat (limited to 'test')
| -rw-r--r-- | test/orm/inheritance/query.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/orm/inheritance/query.py b/test/orm/inheritance/query.py index 28659ba38..eb40f01e5 100644 --- a/test/orm/inheritance/query.py +++ b/test/orm/inheritance/query.py @@ -455,6 +455,25 @@ def make_test(select_type): join('paperwork', from_joinpoint=True, aliased=aliased).filter(Paperwork.description.like('%#%')).all(), [c1, c2] ) + def test_explicit_polymorphic_join(self): + sess = create_session() + + # join from Company to Engineer; join condition formulated by + # ORMJoin using regular table foreign key connections. Engineer + # is expressed as "(select * people join engineers) as anon_1" + # so the join is contained. + self.assertEquals( + sess.query(Company).join(Engineer).filter(Engineer.engineer_name=='vlad').one(), + c2 + ) + + # same, using explicit join condition. Query.join() must adapt the on clause + # here to match the subquery wrapped around "people join engineers". + self.assertEquals( + sess.query(Company).join((Engineer, Company.company_id==Engineer.company_id)).filter(Engineer.engineer_name=='vlad').one(), + c2 + ) + def test_filter_on_baseclass(self): sess = create_session() |
