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

Signature de la méthode pending_to_persistent

def pending_to_persistent(self, session, instance) 

Description

pending_to_persistent.__doc__

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

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


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

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


This event is invoked within the flush process, and is
similar to scanning the :attr:`.Session.new` collection within
the :meth:`.SessionEvents.after_flush` event.  However, in this
case the object has already been moved to the persistent state
when the event is called.

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

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

.. versionadded:: 1.1

.. seealso::

    :ref:`session_lifecycle_events`