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

Method _remove_snapshot

lib/sqlalchemy/orm/session.py:1130–1152  ·  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

1128 s._expire(s.dict, self.session.identity_map._modified)
1129
1130 def _remove_snapshot(self) -> None:
1131 """Remove the restoration state taken before a transaction began.
1132
1133 Corresponds to a commit.
1134
1135 """
1136 assert self._is_transaction_boundary
1137
1138 if not self.nested and self.session.expire_on_commit:
1139 for s in self.session.identity_map.all_states():
1140 s._expire(s.dict, self.session.identity_map._modified)
1141
1142 statelib.InstanceState._detach_states(
1143 list(self._deleted), self.session
1144 )
1145 self._deleted.clear()
1146 elif self.nested:
1147 parent = self._parent
1148 assert parent is not None
1149 parent._new.update(self._new)
1150 parent._dirty.update(self._dirty)
1151 parent._deleted.update(self._deleted)
1152 parent._key_switches.update(self._key_switches)
1153
1154 @_StateChange.declare_states(
1155 (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