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

Function flag_dirty

lib/sqlalchemy/orm/attributes.py:2824–2845  ·  view source on GitHub ↗

Mark an instance as 'dirty' without any specific attribute mentioned. This is a special operation that will allow the object to travel through the flush process for interception by events such as :meth:`.SessionEvents.before_flush`. Note that no SQL will be emitted in the flush pr

(instance: object)

Source from the content-addressed store, hash-verified

2822
2823
2824def flag_dirty(instance: object) -> None:
2825 """Mark an instance as 'dirty' without any specific attribute mentioned.
2826
2827 This is a special operation that will allow the object to travel through
2828 the flush process for interception by events such as
2829 :meth:`.SessionEvents.before_flush`. Note that no SQL will be emitted in
2830 the flush process for an object that has no changes, even if marked dirty
2831 via this method. However, a :meth:`.SessionEvents.before_flush` handler
2832 will be able to see the object in the :attr:`.Session.dirty` collection and
2833 may establish changes on it, which will then be included in the SQL
2834 emitted.
2835
2836 .. versionadded:: 1.2
2837
2838 .. seealso::
2839
2840 :func:`.attributes.flag_modified`
2841
2842 """
2843
2844 state, dict_ = instance_state(instance), instance_dict(instance)
2845 state._modified_event(dict_, None, NO_VALUE, is_userland=True)

Callers

nothing calls this directly

Calls 3

instance_stateFunction · 0.85
instance_dictFunction · 0.85
_modified_eventMethod · 0.45

Tested by

no test coverage detected