MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / merge

Method merge

lib/sqlalchemy/orm/properties.py:338–362  ·  view source on GitHub ↗
(
        self,
        session: Session,
        source_state: InstanceState[Any],
        source_dict: _InstanceDict,
        dest_state: InstanceState[Any],
        dest_dict: _InstanceDict,
        load: bool,
        _recursive: Dict[Any, object],
        _resolve_conflict_map: Dict[_IdentityKeyType[Any], object],
    )

Source from the content-addressed store, hash-verified

336 )
337
338 def merge(
339 self,
340 session: Session,
341 source_state: InstanceState[Any],
342 source_dict: _InstanceDict,
343 dest_state: InstanceState[Any],
344 dest_dict: _InstanceDict,
345 load: bool,
346 _recursive: Dict[Any, object],
347 _resolve_conflict_map: Dict[_IdentityKeyType[Any], object],
348 ) -> None:
349 if not self.instrument:
350 return
351 elif self.key in source_dict:
352 value = source_dict[self.key]
353
354 if not load:
355 dest_dict[self.key] = value
356 else:
357 impl = dest_state.get_impl(self.key)
358 impl.set(dest_state, dest_dict, value, None)
359 elif dest_state.has_identity and self.key not in dest_dict:
360 dest_state._expire_attributes(
361 dest_dict, [self.key], no_loader=True
362 )
363
364 class Comparator(util.MemoizedSlots, PropComparator[_PT]):
365 """Produce boolean, comparison, and other operators for

Callers

nothing calls this directly

Calls 3

_expire_attributesMethod · 0.80
get_implMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected