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

Method after_attach

lib/sqlalchemy/orm/events.py:2071–2093  ·  view source on GitHub ↗

Execute after an instance is attached to a session. 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

(self, session: Session, instance: _O)

Source from the content-addressed store, hash-verified

2069
2070 @_lifecycle_event
2071 def after_attach(self, session: Session, instance: _O) -> None:
2072 """Execute after an instance is attached to a session.
2073
2074 This is called after an add, delete or merge.
2075
2076 .. note::
2077
2078 As of 0.8, this event fires off *after* the item
2079 has been fully associated with the session, which is
2080 different than previous releases. For event
2081 handlers that require the object not yet
2082 be part of session state (such as handlers which
2083 may autoflush while the target object is not
2084 yet complete) consider the
2085 new :meth:`.before_attach` event.
2086
2087 .. seealso::
2088
2089 :meth:`~.SessionEvents.before_attach`
2090
2091 :ref:`session_lifecycle_events`
2092
2093 """
2094
2095 @event._legacy_signature(
2096 "0.9",

Callers 1

_after_attachMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected