]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- changelog, improve docstring/test for #3217. fixes #3217
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 26 Nov 2014 18:50:43 +0000 (13:50 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 26 Nov 2014 18:50:43 +0000 (13:50 -0500)
doc/build/changelog/changelog_10.rst
lib/sqlalchemy/orm/query.py
test/orm/test_joins.py

index d0d025011c1aa784d13b010c52e4e3c63a224d0c..4a350370f06550a317c248ea05374a83876bf487 100644 (file)
     series as well.  For changes that are specific to 1.0 with an emphasis
     on compatibility concerns, see :doc:`/changelog/migration_10`.
 
+    .. change::
+        :tags: feature, orm
+        :tickets: 3217
+
+        Added a parameter :paramref:`.Query.join.isouter` which is synonymous
+        with calling :meth:`.Query.outerjoin`; this flag is to provide a more
+        consistent interface compared to Core :meth:`.FromClause.join`.
+        Pull request courtesy Jonathan Vanasco.
+
     .. change::
         :tags: bug, sql
         :tickets: 3243
index 884e04bbc849f5da17a09a5f4fefd96b9fdcac80..790686288c54c7a0b265237e5541e7a2ebfc4a51 100644 (file)
@@ -1741,7 +1741,13 @@ class Query(object):
          and similar will adapt the incoming criterion to the target
          alias, until :meth:`~.Query.reset_joinpoint` is called.
         :param isouter=False: If True, the join used will be a left outer join,
-         just as if the ``outerjoin()`` method were called.
+         just as if the :meth:`.Query.outerjoin` method were called.  This
+         flag is here to maintain consistency with the same flag as accepted
+         by :meth:`.FromClause.join` and other Core constructs.
+
+
+         .. versionadded:: 1.0.0
+
         :param from_joinpoint=False: When using ``aliased=True``, a setting
          of True here will cause the join to be from the most recent
          joined target, rather than starting back from the original
index 98888862f0623c25f358c71745a518d17c11fa5c..979ab05188653e781a5bce16d11d5f83af5f4242 100644 (file)
@@ -430,6 +430,16 @@ class JoinTest(QueryTest, AssertsCompiledSQL):
             sess.query(literal_column('x'), User).join, Address
         )
 
+    def test_isouter_flag(self):
+        User = self.classes.User
+
+        self.assert_compile(
+            create_session().query(User).join('orders', isouter=True),
+            "SELECT users.id AS users_id, users.name AS users_name "
+            "FROM users LEFT OUTER JOIN orders ON users.id = orders.user_id"
+        )
+
+
     def test_multi_tuple_form(self):
         """test the 'tuple' form of join, now superseded
         by the two-element join() form.
@@ -724,13 +734,6 @@ 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_overlapping_paths_join_isouter(self):
-        User = self.classes.User
-
-        result = create_session().query(User).join('orders', 'items', isouter=True).\
-                filter_by(id=3).join('orders','address', isouter=True).filter_by(id=1).all()
-        assert [User(id=7, name='jack')] == result
-
     def test_from_joinpoint(self):
         Item, User, Order = (self.classes.Item,
                                 self.classes.User,