MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / commit

Method commit

lib/sqlalchemy/orm/session.py:1326–1347  ·  view source on GitHub ↗
(self, _to_root: bool = False)

Source from the content-addressed store, hash-verified

1324 SessionTransactionState.CLOSED,
1325 )
1326 def commit(self, _to_root: bool = False) -> None:
1327 if self._state is not SessionTransactionState.PREPARED:
1328 with self._expect_state(SessionTransactionState.PREPARED):
1329 self._prepare_impl()
1330
1331 if self._parent is None or self.nested:
1332 for conn, trans, should_commit, autoclose in set(
1333 self._connections.values()
1334 ):
1335 if should_commit:
1336 trans.commit()
1337
1338 self._state = SessionTransactionState.COMMITTED
1339 self.session.dispatch.after_commit(self.session)
1340
1341 self._remove_snapshot()
1342
1343 with self._expect_state(SessionTransactionState.CLOSED):
1344 self.close()
1345
1346 if _to_root and self._parent:
1347 self._parent.commit(_to_root=True)
1348
1349 @_StateChange.declare_states(
1350 (

Callers

nothing calls this directly

Calls 7

_prepare_implMethod · 0.95
_remove_snapshotMethod · 0.95
closeMethod · 0.95
_expect_stateMethod · 0.80
after_commitMethod · 0.80
valuesMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected