MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / flag_dirty

Function flag_dirty

lib/sqlalchemy/orm/attributes.py:2849–2868  ·  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

2847
2848
2849def flag_dirty(instance: object) -> None:
2850 """Mark an instance as 'dirty' without any specific attribute mentioned.
2851
2852 This is a special operation that will allow the object to travel through
2853 the flush process for interception by events such as
2854 :meth:`.SessionEvents.before_flush`. Note that no SQL will be emitted in
2855 the flush process for an object that has no changes, even if marked dirty
2856 via this method. However, a :meth:`.SessionEvents.before_flush` handler
2857 will be able to see the object in the :attr:`.Session.dirty` collection and
2858 may establish changes on it, which will then be included in the SQL
2859 emitted.
2860
2861 .. seealso::
2862
2863 :func:`.attributes.flag_modified`
2864
2865 """
2866
2867 state, dict_ = instance_state(instance), instance_dict(instance)
2868 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