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_attach

Signature de la méthode after_attach

def after_attach(self, session, instance) 

Description

after_attach.__doc__

Execute after an instance is attached to a session.

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


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

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


This is called after an add, delete or merge.

.. note::

   As of 0.8, this event fires off *after* the item
   has been fully associated with the session, which is
   different than previous releases.  For event
   handlers that require the object not yet
   be part of session state (such as handlers which
   may autoflush while the target object is not
   yet complete) consider the
   new :meth:`.before_attach` event.

.. seealso::

    :meth:`~.SessionEvents.before_attach`

    :ref:`session_lifecycle_events`