(
self,
context,
path,
states,
load_only,
effective_entity,
loadopt,
recursion_depth,
execution_options,
)
| 3178 | ) |
| 3179 | |
| 3180 | def _load_for_path( |
| 3181 | self, |
| 3182 | context, |
| 3183 | path, |
| 3184 | states, |
| 3185 | load_only, |
| 3186 | effective_entity, |
| 3187 | loadopt, |
| 3188 | recursion_depth, |
| 3189 | execution_options, |
| 3190 | ): |
| 3191 | if load_only and self.key not in load_only: |
| 3192 | return |
| 3193 | |
| 3194 | query_info = self._query_info |
| 3195 | |
| 3196 | if query_info.load_only_child: |
| 3197 | our_states = collections.defaultdict(list) |
| 3198 | none_states = [] |
| 3199 | |
| 3200 | mapper = self.parent |
| 3201 | |
| 3202 | # attribute keys for the lookup columns; when these are |
| 3203 | # present in a state's dict, reading them directly is |
| 3204 | # equivalent to the PASSIVE_NO_FETCH attribute lookup below. |
| 3205 | # whether or not a key is present can vary per state, e.g. |
| 3206 | # individual instances may have the attribute expired or |
| 3207 | # deferred, so this is determined state-by-state |
| 3208 | get_related_ident = mapper._state_ident_getter( |
| 3209 | query_info.child_lookup_cols, |
| 3210 | passive=attributes.PASSIVE_NO_FETCH, |
| 3211 | ) |
| 3212 | |
| 3213 | for state, overwrite in states: |
| 3214 | state_dict = state.dict |
| 3215 | related_ident = get_related_ident(state, state_dict) |
| 3216 | # if the loaded parent objects do not have the foreign key |
| 3217 | # to the related item loaded, then degrade into the joined |
| 3218 | # version of selectinload |
| 3219 | if LoaderCallableStatus.PASSIVE_NO_RESULT in related_ident: |
| 3220 | query_info = self._fallback_query_info |
| 3221 | break |
| 3222 | |
| 3223 | # organize states into lists keyed to particular foreign |
| 3224 | # key values. |
| 3225 | if None not in related_ident: |
| 3226 | our_states[related_ident].append( |
| 3227 | (state, state_dict, overwrite) |
| 3228 | ) |
| 3229 | else: |
| 3230 | # For FK values that have None, add them to a |
| 3231 | # separate collection that will be populated separately |
| 3232 | none_states.append((state, state_dict, overwrite)) |
| 3233 | |
| 3234 | # note the above conditional may have changed query_info |
| 3235 | if not query_info.load_only_child: |
| 3236 | our_states = [ |
| 3237 | (state.key[1], state, state.dict, overwrite) |
nothing calls this directly
no test coverage detected