(
self,
attrs: Optional[Tuple[_AttrType, ...]],
strategy: Optional[_StrategyKey],
wildcard_key: Optional[_WildcardKeyType],
opts: Optional[_OptsType] = None,
attr_group: Optional[_AttrGroupType] = None,
propagate_to_loaders: bool = True,
reconcile_to_other: Optional[bool] = None,
extra_criteria: Optional[Tuple[Any, ...]] = None,
)
| 1229 | return self |
| 1230 | |
| 1231 | def _clone_for_bind_strategy( |
| 1232 | self, |
| 1233 | attrs: Optional[Tuple[_AttrType, ...]], |
| 1234 | strategy: Optional[_StrategyKey], |
| 1235 | wildcard_key: Optional[_WildcardKeyType], |
| 1236 | opts: Optional[_OptsType] = None, |
| 1237 | attr_group: Optional[_AttrGroupType] = None, |
| 1238 | propagate_to_loaders: bool = True, |
| 1239 | reconcile_to_other: Optional[bool] = None, |
| 1240 | extra_criteria: Optional[Tuple[Any, ...]] = None, |
| 1241 | ) -> Self: |
| 1242 | # for individual strategy that needs to propagate, set the whole |
| 1243 | # Load container to also propagate, so that it shows up in |
| 1244 | # InstanceState.load_options |
| 1245 | if propagate_to_loaders: |
| 1246 | self.propagate_to_loaders = True |
| 1247 | |
| 1248 | if self.path.is_token: |
| 1249 | raise sa_exc.ArgumentError( |
| 1250 | "Wildcard token cannot be followed by another entity" |
| 1251 | ) |
| 1252 | |
| 1253 | elif path_is_property(self.path): |
| 1254 | # reuse the lookup which will raise a nicely formatted |
| 1255 | # LoaderStrategyException |
| 1256 | if strategy: |
| 1257 | self.path.prop._strategy_lookup(self.path.prop, strategy[0]) |
| 1258 | else: |
| 1259 | raise sa_exc.ArgumentError( |
| 1260 | f"Mapped attribute '{self.path.prop}' does not " |
| 1261 | "refer to a mapped entity" |
| 1262 | ) |
| 1263 | |
| 1264 | if attrs is None: |
| 1265 | load_element = _ClassStrategyLoad.create( |
| 1266 | self.path, |
| 1267 | None, |
| 1268 | strategy, |
| 1269 | wildcard_key, |
| 1270 | opts, |
| 1271 | propagate_to_loaders, |
| 1272 | attr_group=attr_group, |
| 1273 | reconcile_to_other=reconcile_to_other, |
| 1274 | extra_criteria=extra_criteria, |
| 1275 | ) |
| 1276 | if load_element: |
| 1277 | self.context += (load_element,) |
| 1278 | assert opts is not None |
| 1279 | self.additional_source_entities += cast( |
| 1280 | "Tuple[_InternalEntityType[Any]]", opts["entities"] |
| 1281 | ) |
| 1282 | |
| 1283 | else: |
| 1284 | for attr in attrs: |
| 1285 | if isinstance(attr, str): |
| 1286 | load_element = _TokenStrategyLoad.create( |
| 1287 | self.path, |
| 1288 | attr, |
nothing calls this directly
no test coverage detected