MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / flag_modified

Function flag_modified

lib/sqlalchemy/orm/attributes.py:2826–2846  ·  lib/sqlalchemy/orm/attributes.py::flag_modified

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

2824
2825
2826def flag_modified(instance: object, key: str) -> None:
2827 class="st">"""Mark an attribute on an instance as &class="cm">#x27;modified'.
2828
2829 This sets the &class="cm">#x27;modified' flag on the instance and
2830 establishes an unconditional change event for the given attribute.
2831 The attribute must have a value present, else an
2832 :class:`.InvalidRequestError` is raised.
2833
2834 To mark an object class="st">"dirty" without referring to any specific attribute
2835 so that it is considered within a flush, use the
2836 :func:`.attributes.flag_dirty` call.
2837
2838 .. seealso::
2839
2840 :func:`.attributes.flag_dirty`
2841
2842 class="st">"""
2843 state, dict_ = instance_state(instance), instance_dict(instance)
2844 impl = state.manager[key].impl
2845 impl.dispatch.modified(state, impl._modified_token)
2846 state._modified_event(dict_, impl, NO_VALUE, is_userland=True)
2847
2848
2849def 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