class documentation

class RootTransaction(Transaction):

Known subclasses: sqlalchemy.engine.base.TwoPhaseTransaction

View In Hierarchy

Represent the "root" transaction on a _engine.Connection.

This corresponds to the current "BEGIN/COMMIT/ROLLBACK" that's occurring for the _engine.Connection. The _engine.RootTransaction is created by calling upon the _engine.Connection.begin method, and remains associated with the _engine.Connection throughout its active span. The current _engine.RootTransaction in use is accessible via the _engine.Connection.get_transaction method of _engine.Connection.

In :term:`2.0 style` use, the _future.Connection also employs "autobegin" behavior that will create a new _engine.RootTransaction whenever a connection in a non-transactional state is used to emit commands on the DBAPI connection. The scope of the _engine.RootTransaction in 2.0 style use can be controlled using the _future.Connection.commit and _future.Connection.rollback methods.

Method __init__ Undocumented
Method ​_close​_impl Undocumented
Method ​_connection​_begin​_impl Undocumented
Method ​_connection​_commit​_impl Undocumented
Method ​_connection​_rollback​_impl Undocumented
Method ​_deactivate​_from​_connection Undocumented
Method ​_do​_close Undocumented
Method ​_do​_commit Undocumented
Method ​_do​_deactivate do whatever steps are necessary to set this transaction as "deactive", however leave this transaction object in place as far as the connection's state.
Method ​_do​_rollback Undocumented
Class Variable __slots__ Undocumented
Class Variable ​_is​_root Undocumented
Instance Variable connection Undocumented
Instance Variable is​_active 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 ​_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
Method close Close this .Transaction.
Method commit Commit this .Transaction.
Method rollback Roll back this .Transaction.
Property is​_valid Undocumented

Inherited from TransactionalContext (via Transaction):

Class Method ​_trans​_ctx​_check Undocumented
Method __enter__ Undocumented
Method __exit__ Undocumented
Instance Variable ​_outer​_trans​_ctx Undocumented
Instance Variable ​_trans​_subject Undocumented
def __init__(self, connection):
def _close_impl(self, try_deactivate=False):

Undocumented

def _connection_begin_impl(self):

Undocumented

def _connection_commit_impl(self):

Undocumented

def _connection_rollback_impl(self):

Undocumented

def _deactivate_from_connection(self):

Undocumented

def _do_close(self):
def _do_commit(self):
def _do_deactivate(self):

do whatever steps are necessary to set this transaction as "deactive", however leave this transaction object in place as far as the connection's state.

for a "real" transaction this should roll back the transaction and ensure this transaction is no longer a reset agent.

this is used for nesting of marker transactions where the marker can set the "real" transaction as rolled back, however it stays in place.

for 2.0 we hope to remove this nesting feature.

def _do_rollback(self):
__slots__: tuple[str, ...] =
_is_root: bool =
connection =

Undocumented

is_active: bool =

Undocumented

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