MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _WildcardLoad

Class _WildcardLoad

lib/sqlalchemy/orm/strategy_options.py:1337–1526  ·  view source on GitHub ↗

represent a standalone '*' load operation

Source from the content-addressed store, hash-verified

1335
1336
1337class _WildcardLoad(_AbstractLoad):
1338 """represent a standalone '*' load operation"""
1339
1340 __slots__ = ("strategy", "path", "local_opts")
1341
1342 _traverse_internals = [
1343 ("strategy", visitors.ExtendedInternalTraversal.dp_plain_obj),
1344 ("path", visitors.ExtendedInternalTraversal.dp_plain_obj),
1345 (
1346 "local_opts",
1347 visitors.ExtendedInternalTraversal.dp_string_multi_dict,
1348 ),
1349 ]
1350 cache_key_traversal: _CacheKeyTraversalType = None
1351
1352 strategy: Optional[Tuple[Any, ...]]
1353 local_opts: _OptsType
1354 path: Union[Tuple[()], Tuple[str]]
1355 propagate_to_loaders = False
1356
1357 def __init__(self) -> None:
1358 self.path = ()
1359 self.strategy = None
1360 self.local_opts = util.EMPTY_DICT
1361
1362 def _clone_for_bind_strategy(
1363 self,
1364 attrs,
1365 strategy,
1366 wildcard_key,
1367 opts=None,
1368 attr_group=None,
1369 propagate_to_loaders=True,
1370 reconcile_to_other=None,
1371 extra_criteria=None,
1372 ):
1373 assert attrs is not None
1374 attr = attrs[0]
1375 assert (
1376 wildcard_key
1377 and isinstance(attr, str)
1378 and attr in (_WILDCARD_TOKEN, _DEFAULT_TOKEN)
1379 )
1380
1381 attr = f"{wildcard_key}:{attr}"
1382
1383 self.strategy = strategy
1384 self.path = (attr,)
1385 if opts:
1386 self.local_opts = util.immutabledict(opts)
1387
1388 assert extra_criteria is None
1389
1390 def options(self, *opts: _AbstractLoad) -> Self:
1391 raise NotImplementedError("Star option does not support sub-options")
1392
1393 def _apply_to_parent(self, parent: Load) -> None:
1394 """apply this :class:`_orm._WildcardLoad` object as a sub-option of

Callers 2

_generate_from_keysFunction · 0.85
undefer_groupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected