diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-04-15 17:30:23 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-04-15 17:30:23 -0400 |
commit | 2bc8c92279a165563b7ebcf82c96cd3cd7ede2a2 (patch) | |
tree | b73c1a6dda4b6f3078bf6e371d813834e8eaa41f /test/orm/test_joins.py | |
parent | 623e5b2149499d81d42936cd2907ebcc3ca48e8c (diff) | |
download | sqlalchemy-2bc8c92279a165563b7ebcf82c96cd3cd7ede2a2.tar.gz |
- Identified an inconsistency when handling :meth:`.Query.join` to the
same target more than once; it implicitly dedupes only in the case of
a relationship join, and due to :ticket:`3233`, in 1.0 a join
to the same table twice behaves differently than 0.9 in that it no
longer erroneously aliases. To help document this change,
the verbiage regarding :ticket:`3233` in the migration notes has
been generalized, and a warning has been added when :meth:`.Query.join`
is called against the same target relationship more than once.
fixes #3367
Diffstat (limited to 'test/orm/test_joins.py')
-rw-r--r-- | test/orm/test_joins.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/orm/test_joins.py b/test/orm/test_joins.py index 23d220dcc..540056dae 100644 --- a/test/orm/test_joins.py +++ b/test/orm/test_joins.py @@ -750,6 +750,17 @@ class JoinTest(QueryTest, AssertsCompiledSQL): filter_by(id=3).outerjoin('orders','address').filter_by(id=1).all() assert [User(id=7, name='jack')] == result + def test_raises_on_dupe_target_rel(self): + User = self.classes.User + + assert_raises_message( + sa.exc.SAWarning, + "Pathed join target Order.items has already been joined to; " + "skipping", + lambda: create_session().query(User).outerjoin('orders', 'items').\ + outerjoin('orders', 'items') + ) + def test_from_joinpoint(self): Item, User, Order = (self.classes.Item, self.classes.User, |