]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Remove the deprecated loader options
authorFederico Caselli <cfederico87@gmail.com>
Tue, 3 Mar 2020 21:32:19 +0000 (22:32 +0100)
committerFederico Caselli <cfederico87@gmail.com>
Tue, 3 Mar 2020 21:33:49 +0000 (21:33 +0000)
Remove the deprecated loader options ``joinedload_all``, ``subqueryload_all``,
``lazyload_all``, ``selectinload_all``. The normal version with method chaining
should be used in their place.

Fixes: #4642
Change-Id: I12eb4dfa7a86375911a570934ee662653d85d50a

doc/build/changelog/unreleased_14/4642.rst [new file with mode: 0644]
doc/build/orm/loading_relationships.rst
examples/adjacency_list/adjacency_list.py
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/strategy_options.py
test/orm/test_deprecations.py

diff --git a/doc/build/changelog/unreleased_14/4642.rst b/doc/build/changelog/unreleased_14/4642.rst
new file mode 100644 (file)
index 0000000..cefdabb
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+   :tags: orm
+   :tickets: 4642
+
+   Remove the deprecated loader options ``joinedload_all``, ``subqueryload_all``,
+   ``lazyload_all``, ``selectinload_all``. The normal version with method chaining
+   should be used in their place.
index 556759eebbba4c4a40bc0c2e0d988e05fe09764d..9da0dfd41309528432ba8eccb1a469577dc6012c 100644 (file)
@@ -1258,14 +1258,10 @@ Relationship Loader API
 
 .. autofunction:: eagerload
 
-.. autofunction:: eagerload_all
-
 .. autofunction:: immediateload
 
 .. autofunction:: joinedload
 
-.. autofunction:: joinedload_all
-
 .. autofunction:: lazyload
 
 .. autoclass:: Load
@@ -1276,8 +1272,4 @@ Relationship Loader API
 
 .. autofunction:: selectinload
 
-.. autofunction:: selectinload_all
-
 .. autofunction:: subqueryload
-
-.. autofunction:: subqueryload_all
index 8cdd8854031b8627668f89e758992f5d7d3bcd82..fee0f413f66919b5110ae6b23c94f96777e31abc 100644 (file)
@@ -5,7 +5,7 @@ from sqlalchemy import Integer
 from sqlalchemy import String
 from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy.orm import backref
-from sqlalchemy.orm import joinedload_all
+from sqlalchemy.orm import joinedload
 from sqlalchemy.orm import relationship
 from sqlalchemy.orm import Session
 from sqlalchemy.orm.collections import attribute_mapped_collection
@@ -108,7 +108,10 @@ if __name__ == "__main__":
     node = (
         session.query(TreeNode)
         .options(
-            joinedload_all("children", "children", "children", "children")
+            joinedload("children")
+            .joinedload("children")
+            .joinedload("children")
+            .joinedload("children")
         )
         .filter(TreeNode.name == "rootnode")
         .first()
index 05fcc3fc9938313ac97d11e5a4df7bab8c8ac1cd..307f55ad0a3f65c392696b7b8e20eec11e1197cb 100644 (file)
@@ -238,7 +238,6 @@ def clear_mappers():
 
 
 joinedload = strategy_options.joinedload._unbound_fn
-joinedload_all = strategy_options.joinedload._unbound_all_fn
 contains_eager = strategy_options.contains_eager._unbound_fn
 defer = strategy_options.defer._unbound_fn
 undefer = strategy_options.undefer._unbound_fn
@@ -246,11 +245,8 @@ undefer_group = strategy_options.undefer_group._unbound_fn
 with_expression = strategy_options.with_expression._unbound_fn
 load_only = strategy_options.load_only._unbound_fn
 lazyload = strategy_options.lazyload._unbound_fn
-lazyload_all = strategy_options.lazyload_all._unbound_all_fn
 subqueryload = strategy_options.subqueryload._unbound_fn
-subqueryload_all = strategy_options.subqueryload_all._unbound_all_fn
 selectinload = strategy_options.selectinload._unbound_fn
-selectinload_all = strategy_options.selectinload_all._unbound_all_fn
 immediateload = strategy_options.immediateload._unbound_fn
 noload = strategy_options.noload._unbound_fn
 raiseload = strategy_options.raiseload._unbound_fn
@@ -263,11 +259,6 @@ def eagerload(*args, **kwargs):
     return joinedload(*args, **kwargs)
 
 
-def eagerload_all(*args, **kwargs):
-    """A synonym for :func:`joinedload_all()`"""
-    return joinedload_all(*args, **kwargs)
-
-
 contains_alias = public_factory(AliasOption, ".orm.contains_alias")
 
 
index 4f7d996d4f0871cecc16ba05e88ac55dc79fdd5c..b7ccd7ff5ae8a498d0fb6ac1f91716f4c0cf63d4 100644 (file)
@@ -1258,11 +1258,6 @@ def joinedload(*keys, **kw):
     return _UnboundLoad._from_keys(_UnboundLoad.joinedload, keys, False, kw)
 
 
-@joinedload._add_unbound_all_fn
-def joinedload_all(*keys, **kw):
-    return _UnboundLoad._from_keys(_UnboundLoad.joinedload, keys, True, kw)
-
-
 @loader_option()
 def subqueryload(loadopt, attr):
     """Indicate that the given attribute should be loaded using
@@ -1301,11 +1296,6 @@ def subqueryload(*keys):
     return _UnboundLoad._from_keys(_UnboundLoad.subqueryload, keys, False, {})
 
 
-@subqueryload._add_unbound_all_fn
-def subqueryload_all(*keys):
-    return _UnboundLoad._from_keys(_UnboundLoad.subqueryload, keys, True, {})
-
-
 @loader_option()
 def selectinload(loadopt, attr):
     """Indicate that the given attribute should be loaded using
@@ -1345,11 +1335,6 @@ def selectinload(*keys):
     return _UnboundLoad._from_keys(_UnboundLoad.selectinload, keys, False, {})
 
 
-@selectinload._add_unbound_all_fn
-def selectinload_all(*keys):
-    return _UnboundLoad._from_keys(_UnboundLoad.selectinload, keys, True, {})
-
-
 @loader_option()
 def lazyload(loadopt, attr):
     """Indicate that the given attribute should be loaded using "lazy"
@@ -1373,11 +1358,6 @@ def lazyload(*keys):
     return _UnboundLoad._from_keys(_UnboundLoad.lazyload, keys, False, {})
 
 
-@lazyload._add_unbound_all_fn
-def lazyload_all(*keys):
-    return _UnboundLoad._from_keys(_UnboundLoad.lazyload, keys, True, {})
-
-
 @loader_option()
 def immediateload(loadopt, attr):
     """Indicate that the given attribute should be loaded using
index bf045223494431817a91edaa40b8b8c871ca2f02..1097af245c392a15e2d1805b71c0a6803f01156c 100644 (file)
@@ -25,7 +25,6 @@ from sqlalchemy.orm import foreign
 from sqlalchemy.orm import identity
 from sqlalchemy.orm import instrumentation
 from sqlalchemy.orm import joinedload
-from sqlalchemy.orm import joinedload_all
 from sqlalchemy.orm import mapper
 from sqlalchemy.orm import PropComparator
 from sqlalchemy.orm import relationship
@@ -1395,57 +1394,6 @@ class DeprecatedOptionAllTest(OptionsPathTest, _fixtures.FixtureTest):
             *options
         )
 
-    def test_option_against_nonexistent_twolevel_all(self):
-        self._mapper_fixture_one()
-        Item = self.classes.Item
-        with testing.expect_deprecated(
-            r"The joinedload_all\(\) function is deprecated, and "
-            "will be removed in a future release.  "
-            r"Please use method chaining with joinedload\(\)"
-        ):
-            self._assert_eager_with_entity_exception(
-                [Item],
-                (joinedload_all("keywords.foo"),),
-                'Can\'t find property named \\"foo\\" on mapped class '
-                "Keyword->keywords in this Query.",
-            )
-
-    def test_all_path_vs_chained(self):
-        self._mapper_fixture_one()
-        User = self.classes.User
-        Order = self.classes.Order
-        Item = self.classes.Item
-
-        with testing.expect_deprecated(
-            r"The joinedload_all\(\) function is deprecated, and "
-            "will be removed in a future release.  "
-            r"Please use method chaining with joinedload\(\)"
-        ):
-            l1 = joinedload_all("orders.items.keywords")
-
-        sess = Session()
-        q = sess.query(User)
-        self._assert_path_result(
-            l1,
-            q,
-            [
-                (User, "orders"),
-                (User, "orders", Order, "items"),
-                (User, "orders", Order, "items", Item, "keywords"),
-            ],
-        )
-
-        l2 = joinedload("orders").joinedload("items").joinedload("keywords")
-        self._assert_path_result(
-            l2,
-            q,
-            [
-                (User, "orders"),
-                (User, "orders", Order, "items"),
-                (User, "orders", Order, "items", Item, "keywords"),
-            ],
-        )
-
     def test_subqueryload_mapper_order_by(self):
         users, User, Address, addresses = (
             self.tables.users,