class documentation

class NestedTransaction(Transaction): (source)

View In Hierarchy

Represent a 'nested', or SAVEPOINT transaction. The :class:`.NestedTransaction` object is created by calling the :meth:`_engine.Connection.begin_nested` method of :class:`_engine.Connection`. When using :class:`.NestedTransaction`, the semantics of "begin" / "commit" / "rollback" are as follows: * the "begin" operation corresponds to the "BEGIN SAVEPOINT" command, where the savepoint is given an explicit name that is part of the state of this object. * The :meth:`.NestedTransaction.commit` method corresponds to a "RELEASE SAVEPOINT" operation, using the savepoint identifier associated with this :class:`.NestedTransaction`. * The :meth:`.NestedTransaction.rollback` method corresponds to a "ROLLBACK TO SAVEPOINT" operation, using the savepoint identifier associated with this :class:`.NestedTransaction`. The rationale for mimicking the semantics of an outer transaction in terms of savepoints so that code may deal with a "savepoint" transaction and an "outer" transaction in an agnostic way. .. seealso:: :ref:`session_begin_nested` - ORM version of the SAVEPOINT API.

Method __init__ Undocumented
Class Variable __slots__ Undocumented
Instance Variable connection Undocumented
Instance Variable is_active Undocumented
Method _cancel Undocumented
Method _close_impl Undocumented
Method _deactivate_from_connection Undocumented
Method _do_close Undocumented
Method _do_commit Undocumented
Method _do_rollback Undocumented
Instance Variable _previous_nested Undocumented
Instance Variable _savepoint Undocumented
Property _deactivated_from_connection True if this transaction is totally deactivated from the connection and therefore can no longer affect its state.

Inherited from Transaction:

Method close Close this :class:`.Transaction`.
Method commit Commit this :class:`.Transaction`.
Method rollback Roll back this :class:`.Transaction`.
Property is_valid Undocumented
Method _get_subject Undocumented
Method _rollback_can_be_called indicates the object is in a state that is known to be acceptable for rollback() to be called.
Method _transaction_is_active Undocumented
Method _transaction_is_closed Undocumented
Class Variable _is_root Undocumented

Inherited from TransactionalContext (via Transaction):

Method __enter__ Undocumented
Method __exit__ Undocumented
Class Method _trans_ctx_check Undocumented
Instance Variable _outer_trans_ctx Undocumented
Instance Variable _trans_subject Undocumented
def __init__(self, connection: Connection): (source)
def _cancel(self): (source)

Undocumented

def _close_impl(self, deactivate_from_connection: bool, warn_already_deactive: bool): (source)

Undocumented

def _deactivate_from_connection(self, warn: bool = True): (source)

Undocumented

def _do_close(self): (source)
def _do_commit(self): (source)
def _do_rollback(self): (source)
_previous_nested = (source)

Undocumented

_savepoint = (source)

Undocumented

@property
_deactivated_from_connection: bool = (source)

True if this transaction is totally deactivated from the connection and therefore can no longer affect its state.