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_detached

Signature de la méthode deleted_to_detached

def deleted_to_detached(self, session, instance) 

Description

deleted_to_detached.__doc__

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

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


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

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


This event is invoked when a deleted object is evicted
from the session.   The typical case when this occurs is when
the transaction for a :class:`.Session` in which the object
was deleted is committed; the object moves from the deleted
state to the detached state.

It is also invoked for objects that were deleted in a flush
when the :meth:`.Session.expunge_all` or :meth:`.Session.close`
events are called, as well as if the object is individually
expunged from its deleted state via :meth:`.Session.expunge`.

.. versionadded:: 1.1

.. seealso::

    :ref:`session_lifecycle_events`