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

Function flag_modified

lib/sqlalchemy/orm/attributes.py:2801–2821  ·  view source on GitHub ↗

Mark an attribute on an instance as 'modified'. This sets the 'modified' flag on the instance and establishes an unconditional change event for the given attribute. The attribute must have a value present, else an :class:`.InvalidRequestError` is raised. To mark an object "dirt

(instance: object, key: str)

Source from the content-addressed store, hash-verified

2799
2800
2801def flag_modified(instance: object, key: str) -> None:
2802 """Mark an attribute on an instance as 'modified'.
2803
2804 This sets the 'modified' flag on the instance and
2805 establishes an unconditional change event for the given attribute.
2806 The attribute must have a value present, else an
2807 :class:`.InvalidRequestError` is raised.
2808
2809 To mark an object "dirty" without referring to any specific attribute
2810 so that it is considered within a flush, use the
2811 :func:`.attributes.flag_dirty` call.
2812
2813 .. seealso::
2814
2815 :func:`.attributes.flag_dirty`
2816
2817 """
2818 state, dict_ = instance_state(instance), instance_dict(instance)
2819 impl = state.manager[key].impl
2820 impl.dispatch.modified(state, impl._modified_token)
2821 state._modified_event(dict_, impl, NO_VALUE, is_userland=True)
2822
2823
2824def flag_dirty(instance: object) -> None:

Callers 3

fsetMethod · 0.85
fdelMethod · 0.85
changedMethod · 0.85

Calls 4

instance_stateFunction · 0.85
instance_dictFunction · 0.85
modifiedMethod · 0.80
_modified_eventMethod · 0.45

Tested by

no test coverage detected