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

Method commit

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

Source from the content-addressed store, hash-verified

1311 SessionTransactionState.CLOSED,
1312 )
1313 def commit(self, _to_root: bool = False) -> None:
1314 if self._state is not SessionTransactionState.PREPARED:
1315 with self._expect_state(SessionTransactionState.PREPARED):
1316 self._prepare_impl()
1317
1318 if self._parent is None or self.nested:
1319 for conn, trans, should_commit, autoclose in set(
1320 self._connections.values()
1321 ):
1322 if should_commit:
1323 trans.commit()
1324
1325 self._state = SessionTransactionState.COMMITTED
1326 self.session.dispatch.after_commit(self.session)
1327
1328 self._remove_snapshot()
1329
1330 with self._expect_state(SessionTransactionState.CLOSED):
1331 self.close()
1332
1333 if _to_root and self._parent:
1334 self._parent.commit(_to_root=True)
1335
1336 @_StateChange.declare_states(
1337 (

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