MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _clear

Function _clear

lib/sqlalchemy/orm/sync.py:81–96  ·  view source on GitHub ↗
(dest, dest_mapper, synchronize_pairs)

Source from the content-addressed store, hash-verified

79
80
81def _clear(dest, dest_mapper, synchronize_pairs):
82 for l, r in synchronize_pairs:
83 if (
84 r.primary_key
85 and dest_mapper._get_state_attr_by_column(dest, dest.dict, r)
86 not in orm_util._none_set
87 ):
88 raise AssertionError(
89 f"Dependency rule on column '{l}' "
90 "tried to blank-out primary key "
91 f"column '{r}' on instance '{orm_util.state_str(dest)}'"
92 )
93 try:
94 dest_mapper._set_state_attr_by_column(dest, dest.dict, r, None)
95 except exc.UnmappedColumnError as err:
96 _raise_col_to_prop(True, None, l, dest_mapper, r, err)
97
98
99def _update(source, source_mapper, dest, old_prefix, synchronize_pairs):

Callers

nothing calls this directly

Calls 3

_raise_col_to_propFunction · 0.85

Tested by

no test coverage detected