MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _remove_snapshot

Method _remove_snapshot

lib/sqlalchemy/orm/session.py:1141–1163  ·  view source on GitHub ↗

Remove the restoration state taken before a transaction began. Corresponds to a commit.

(self)

Source from the content-addressed store, hash-verified

1139 s._expire(s.dict, self.session.identity_map._modified)
1140
1141 def _remove_snapshot(self) -> None:
1142 """Remove the restoration state taken before a transaction began.
1143
1144 Corresponds to a commit.
1145
1146 """
1147 assert self._is_transaction_boundary
1148
1149 if not self.nested and self.session.expire_on_commit:
1150 for s in self.session.identity_map.all_states():
1151 s._expire(s.dict, self.session.identity_map._modified)
1152
1153 statelib.InstanceState._detach_states(
1154 list(self._deleted), self.session
1155 )
1156 self._deleted.clear()
1157 elif self.nested:
1158 parent = self._parent
1159 assert parent is not None
1160 parent._new.update(self._new)
1161 parent._dirty.update(self._dirty)
1162 parent._deleted.update(self._deleted)
1163 parent._key_switches.update(self._key_switches)
1164
1165 @_StateChange.declare_states(
1166 (SessionTransactionState.ACTIVE,), _StateChangeStates.NO_CHANGE

Callers 1

commitMethod · 0.95

Calls 5

_expireMethod · 0.80
_detach_statesMethod · 0.80
all_statesMethod · 0.45
clearMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected