MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _load_for_path

Method _load_for_path

lib/sqlalchemy/orm/strategies.py:1431–1473  ·  view source on GitHub ↗
(
        self,
        context,
        path,
        states,
        load_only,
        loadopt,
        flags,
        recursion_depth,
        execution_options,
    )

Source from the content-addressed store, hash-verified

1429 )
1430
1431 def _load_for_path(
1432 self,
1433 context,
1434 path,
1435 states,
1436 load_only,
1437 loadopt,
1438 flags,
1439 recursion_depth,
1440 execution_options,
1441 ):
1442 if recursion_depth:
1443 new_opt = Load(loadopt.path.entity)
1444 new_opt.context = (
1445 loadopt,
1446 loadopt._recurse(),
1447 )
1448 alternate_effective_path = path._truncate_recursive()
1449 extra_options = (new_opt,)
1450 else:
1451 alternate_effective_path = path
1452 extra_options = ()
1453
1454 key = self.key
1455 lazyloader = self.parent_property._get_strategy((("lazy", "select"),))
1456 for state, overwrite in states:
1457 dict_ = state.dict
1458
1459 if overwrite or key not in dict_:
1460 value = lazyloader._load_for_state(
1461 state,
1462 flags,
1463 extra_options=extra_options,
1464 alternate_effective_path=alternate_effective_path,
1465 execution_options=execution_options,
1466 )
1467 if value not in (
1468 ATTR_WAS_SET,
1469 LoaderCallableStatus.PASSIVE_NO_RESULT,
1470 ):
1471 state.get_impl(key).set_committed_value(
1472 state, dict_, value
1473 )
1474
1475
1476@log.class_logger

Callers

nothing calls this directly

Calls 7

LoadClass · 0.85
_recurseMethod · 0.80
_get_strategyMethod · 0.80
_truncate_recursiveMethod · 0.45
_load_for_stateMethod · 0.45
set_committed_valueMethod · 0.45
get_implMethod · 0.45

Tested by

no test coverage detected