MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / set_committed_value

Function set_committed_value

lib/sqlalchemy/orm/attributes.py:2747–2763  ·  view source on GitHub ↗

Set the value of an attribute with no history events. Cancels any previous history present. The value should be a scalar value for scalar-holding attributes, or an iterable for any collection-holding attribute. This is the same underlying method used when a lazy loader fires o

(instance: object, key: str, value: Any)

Source from the content-addressed store, hash-verified

2745
2746
2747def set_committed_value(instance: object, key: str, value: Any) -> None:
2748 """Set the value of an attribute with no history events.
2749
2750 Cancels any previous history present. The value should be
2751 a scalar value for scalar-holding attributes, or
2752 an iterable for any collection-holding attribute.
2753
2754 This is the same underlying method used when a lazy loader
2755 fires off and loads additional data from the database.
2756 In particular, this method can be used by application code
2757 which has loaded additional attributes or collections through
2758 separate queries, which can then be attached to an instance
2759 as though it were part of its original loaded state.
2760
2761 """
2762 state, dict_ = instance_state(instance), instance_dict(instance)
2763 state.manager[key].impl.set_committed_value(state, dict_, value)
2764
2765
2766def set_attribute(

Callers

nothing calls this directly

Calls 3

instance_stateFunction · 0.85
instance_dictFunction · 0.85
set_committed_valueMethod · 0.45

Tested by

no test coverage detected