MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / process_deletes

Method process_deletes

lib/sqlalchemy/orm/dependency.py:1086–1124  ·  view source on GitHub ↗
(self, uowcommit, states)

Source from the content-addressed store, hash-verified

1084 uowcommit.register_object(st_, isdelete=True)
1085
1086 def process_deletes(self, uowcommit, states):
1087 secondary_delete = []
1088 secondary_insert = []
1089 secondary_update = []
1090
1091 processed = self._get_reversed_processed_set(uowcommit)
1092 tmp = set()
1093 for state in states:
1094 # this history should be cached already, as
1095 # we loaded it in preprocess_deletes
1096 history = uowcommit.get_attribute_history(
1097 state, self.key, self._passive_delete_flag
1098 )
1099 if history:
1100 for child in history.non_added():
1101 if child is None or (
1102 processed is not None and (state, child) in processed
1103 ):
1104 continue
1105 associationrow = {}
1106 if not self._synchronize(
1107 state,
1108 child,
1109 associationrow,
1110 False,
1111 uowcommit,
1112 "delete",
1113 ):
1114 continue
1115 secondary_delete.append(associationrow)
1116
1117 tmp.update((c, state) for c in history.non_added())
1118
1119 if processed is not None:
1120 processed.update(tmp)
1121
1122 self._run_crud(
1123 uowcommit, secondary_insert, secondary_update, secondary_delete
1124 )
1125
1126 def process_saves(self, uowcommit, states):
1127 secondary_delete = []

Callers

nothing calls this directly

Calls 7

_synchronizeMethod · 0.95
_run_crudMethod · 0.95
get_attribute_historyMethod · 0.80
non_addedMethod · 0.80
appendMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected