Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Classe « SessionEvents »

Méthode sqlalchemy.orm.SessionEvents.after_rollback

Signature de la méthode after_rollback

def after_rollback(self, session) 

Description

after_rollback.__doc__

Execute after a real DBAPI rollback has occurred.

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


        @event.listens_for(SomeSessionOrFactory, 'after_rollback')
        def receive_after_rollback(session):
            "listen for the 'after_rollback' event"

            # ... (event handling logic) ...


Note that this event only fires when the *actual* rollback against
the database occurs - it does *not* fire each time the
:meth:`.Session.rollback` method is called, if the underlying
DBAPI transaction has already been rolled back.  In many
cases, the :class:`.Session` will not be in
an "active" state during this event, as the current
transaction is not valid.   To acquire a :class:`.Session`
which is active after the outermost rollback has proceeded,
use the :meth:`.SessionEvents.after_soft_rollback` event, checking the
:attr:`.Session.is_active` flag.

:param session: The target :class:`.Session`.