summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/strategies.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-06-16 14:46:11 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-06-16 14:46:11 -0400
commitc3102b85c40ab4578a0f56ee1e8eee4a6e0aed55 (patch)
tree3a0589663745b1a0a63b7b098053a77184e9d5c6 /lib/sqlalchemy/orm/strategies.py
parentefd4e6dd8a73b956c860d796606f8e6ad652c292 (diff)
downloadsqlalchemy-c3102b85c40ab4578a0f56ee1e8eee4a6e0aed55.tar.gz
Revert "add auto_recurse option to selectinload, immediateload"
this option works very badly with caching and the API is likely not what we want either. Work continues for #8126 including that the additional work in I9f162e0a09c1ed327dd19498aac193f649333a01 tries to add new recursive features. This reverts commit b3a1162553879d1369154e920f3f4129020bb88e.
Diffstat (limited to 'lib/sqlalchemy/orm/strategies.py')
-rw-r--r--lib/sqlalchemy/orm/strategies.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index d4297f84c..c4c0fb180 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -43,7 +43,6 @@ from .interfaces import LoaderStrategy
from .interfaces import StrategizedProperty
from .session import _state_session
from .state import InstanceState
-from .strategy_options import Load
from .util import _none_set
from .util import AliasedClass
from .. import event
@@ -1260,24 +1259,8 @@ class ImmediateLoader(PostLoader):
populators,
):
def load_immediate(state, dict_, row):
- if auto_recurse:
- new_opt = Load(loadopt.path.entity)
- new_opt.context = (loadopt._recurse(),)
- state.load_options += (new_opt,)
-
state.get_impl(self.key).get(state, dict_, flags)
- if loadopt and loadopt.local_opts.get("auto_recurse", False):
- if not self.parent_property._is_self_referential:
- raise sa_exc.InvalidRequestError(
- f"auto_recurse option on relationship "
- f"{self.parent_property} not valid for "
- "non-self-referential relationship"
- )
- auto_recurse = True
- else:
- auto_recurse = False
-
if self._check_recursive_postload(context, path):
# this will not emit SQL and will only emit for a many-to-one
# "use get" load. the "_RELATED" part means it may return
@@ -3020,21 +3003,6 @@ class SelectInLoader(PostLoader, util.MemoizedSlots):
),
)
- if loadopt and loadopt.local_opts.get("auto_recurse", False):
- if not self.parent_property._is_self_referential:
- # how could we do more recursion? auto_recurse is put on
- # the last option in a chain, then _recurse() will walk
- # backwards up the path to see where the pattern repeats
- # and splice it based on that
- raise sa_exc.InvalidRequestError(
- f"auto_recurse option on relationship "
- f"{self.parent_property} not valid for "
- "non-self-referential relationship"
- )
- new_opt = Load(effective_entity)
- new_opt.context = (loadopt._recurse(),)
- new_options += (new_opt,)
-
q = q.options(*new_options)._update_compile_options(
{"_current_path": effective_path}
)