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.deleted_to_persistent

Signature de la méthode deleted_to_persistent

def deleted_to_persistent(self, session, instance) 

Description

deleted_to_persistent.__doc__

Intercept the "deleted to persistent" transition for a specific object.

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


        @event.listens_for(SomeSessionOrFactory, 'deleted_to_persistent')
        def receive_deleted_to_persistent(session, instance):
            "listen for the 'deleted_to_persistent' event"

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


This transition occurs only when an object that's been deleted
successfully in a flush is restored due to a call to
:meth:`.Session.rollback`.   The event is not called under
any other circumstances.

.. versionadded:: 1.1

.. seealso::

    :ref:`session_lifecycle_events`