MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _synchronize

Method _synchronize

lib/sqlalchemy/orm/dependency.py:825–863  ·  view source on GitHub ↗
(
        self,
        state,
        child,
        associationrow,
        clearkeys,
        uowcommit,
        operation=None,
    )

Source from the content-addressed store, hash-verified

823 self._post_update(state, uowcommit, history.sum())
824
825 def _synchronize(
826 self,
827 state,
828 child,
829 associationrow,
830 clearkeys,
831 uowcommit,
832 operation=None,
833 ):
834 if state is None or (
835 not self.post_update and uowcommit.is_deleted(state)
836 ):
837 return
838
839 if (
840 operation is not None
841 and child is not None
842 and not uowcommit.session._contains_state(child)
843 ):
844 util.warn(
845 "Object of type %s not in session, %s "
846 "operation along '%s' won't proceed"
847 % (mapperutil.state_class_str(child), operation, self.prop)
848 )
849 return
850
851 if clearkeys or child is None:
852 sync.clear(state, self.parent, self.prop.synchronize_pairs)
853 else:
854 self._verify_canload(child)
855 sync.populate(
856 child,
857 self.mapper,
858 state,
859 self.parent,
860 self.prop.synchronize_pairs,
861 uowcommit,
862 False,
863 )
864
865
866class DetectKeySwitch(DependencyProcessor):

Callers 2

process_deletesMethod · 0.95
process_savesMethod · 0.95

Calls 6

is_deletedMethod · 0.80
_contains_stateMethod · 0.80
_verify_canloadMethod · 0.80
warnMethod · 0.45
clearMethod · 0.45
populateMethod · 0.45

Tested by

no test coverage detected