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

Signature de la méthode before_flush

def before_flush(self, session, flush_context, instances) 

Description

before_flush.__doc__

Execute before flush process has started.

.. container:: event_signatures

     Example argument forms::

        from sqlalchemy import event


        @event.listens_for(SomeSessionOrFactory, 'before_flush')
        def receive_before_flush(session, flush_context, instances):
            "listen for the 'before_flush' event"

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


:param session: The target :class:`.Session`.
:param flush_context: Internal :class:`.UOWTransaction` object
 which handles the details of the flush.
:param instances: Usually ``None``, this is the collection of
 objects which can be passed to the :meth:`.Session.flush` method
 (note this usage is deprecated).

.. seealso::

    :meth:`~.SessionEvents.after_flush`

    :meth:`~.SessionEvents.after_flush_postexec`

    :ref:`session_persistence_events`