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

Function set_committed_value

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

2718
2719
2720def set_committed_value(instance: object, key: str, value: Any) -> None:
2721 """Set the value of an attribute with no history events.
2722
2723 Cancels any previous history present. The value should be
2724 a scalar value for scalar-holding attributes, or
2725 an iterable for any collection-holding attribute.
2726
2727 This is the same underlying method used when a lazy loader
2728 fires off and loads additional data from the database.
2729 In particular, this method can be used by application code
2730 which has loaded additional attributes or collections through
2731 separate queries, which can then be attached to an instance
2732 as though it were part of its original loaded state.
2733
2734 """
2735 state, dict_ = instance_state(instance), instance_dict(instance)
2736 state.manager[key].impl.set_committed_value(state, dict_, value)
2737
2738
2739def 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