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

Signature de la méthode persistent_to_transient

def persistent_to_transient(self, session, instance) 

Description

persistent_to_transient.__doc__

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

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


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

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


This less common transition occurs when an pending object that has
has been flushed is evicted from the session; this can occur
when the :meth:`.Session.rollback` method rolls back the transaction.

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

:param instance: the ORM-mapped instance being operated upon.

.. versionadded:: 1.1

.. seealso::

    :ref:`session_lifecycle_events`