MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / delete

Method delete

lib/sqlalchemy/orm/attributes.py:1251–1268  ·  view source on GitHub ↗
(self, state: InstanceState[Any], dict_: _InstanceDict)

Source from the content-addressed store, hash-verified

1249 return value
1250
1251 def delete(self, state: InstanceState[Any], dict_: _InstanceDict) -> None:
1252 if self.dispatch._active_history:
1253 old = self.get(state, dict_, PASSIVE_RETURN_NO_VALUE)
1254 else:
1255 old = dict_.get(self.key, NO_VALUE)
1256
1257 if self.dispatch.remove:
1258 self.fire_remove_event(state, dict_, old, self._remove_token)
1259 state._modified_event(dict_, self, old)
1260
1261 existing = dict_.pop(self.key, NO_VALUE)
1262 if (
1263 existing is NO_VALUE
1264 and old is NO_VALUE
1265 and not state.expired
1266 and self.key not in state.expired_attributes
1267 ):
1268 raise AttributeError("%s object does not have a value" % self)
1269
1270 def get_history(
1271 self,

Callers

nothing calls this directly

Calls 4

fire_remove_eventMethod · 0.95
getMethod · 0.45
_modified_eventMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected