MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / after_flush

Method after_flush

lib/sqlalchemy/orm/events.py:1953–1984  ·  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

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

Callers 1

_flushMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected