MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / after_flush

Method after_flush

lib/sqlalchemy/orm/events.py:1964–1995  ·  view source on GitHub ↗

Execute after flush has completed, but before commit has been called. Note that the session's state is still in pre-flush, i.e. 'new', 'dirty', and 'deleted' lists still show pre-flush state as well as the history settings on instance attributes. .. warning:

(
        self, session: Session, flush_context: UOWTransaction
    )

Source from the content-addressed store, hash-verified

1962 """
1963
1964 def after_flush(
1965 self, session: Session, flush_context: UOWTransaction
1966 ) -> None:
1967 """Execute after flush has completed, but before commit has been
1968 called.
1969
1970 Note that the session's state is still in pre-flush, i.e. 'new',
1971 'dirty', and 'deleted' lists still show pre-flush state as well
1972 as the history settings on instance attributes.
1973
1974 .. warning:: This event runs after the :class:`.Session` has emitted
1975 SQL to modify the database, but **before** it has altered its
1976 internal state to reflect those changes, including that newly
1977 inserted objects are placed into the identity map. ORM operations
1978 emitted within this event such as loads of related items
1979 may produce new identity map entries that will immediately
1980 be replaced, sometimes causing confusing results. SQLAlchemy will
1981 emit a warning for this condition as of version 1.3.9.
1982
1983 :param session: The target :class:`.Session`.
1984 :param flush_context: Internal :class:`.UOWTransaction` object
1985 which handles the details of the flush.
1986
1987 .. seealso::
1988
1989 :meth:`~.SessionEvents.before_flush`
1990
1991 :meth:`~.SessionEvents.after_flush_postexec`
1992
1993 :ref:`session_persistence_events`
1994
1995 """
1996
1997 def after_flush_postexec(
1998 self, session: Session, flush_context: UOWTransaction

Callers 1

_flushMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected