MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _save_impl

Method _save_impl

lib/sqlalchemy/orm/session.py:4300–4313  ·  view source on GitHub ↗
(self, state: InstanceState[Any])

Source from the content-addressed store, hash-verified

4298 )
4299
4300 def _save_impl(self, state: InstanceState[Any]) -> None:
4301 if state.key is not None:
4302 raise sa_exc.InvalidRequestError(
4303 "Object '%s' already has an identity - "
4304 "it can't be registered as pending" % state_str(state)
4305 )
4306
4307 obj = state.obj()
4308 to_attach = self._before_attach(state, obj)
4309 if state not in self._new:
4310 self._new[state] = obj
4311 state.insert_order = len(self._new)
4312 if to_attach:
4313 self._after_attach(state, obj)
4314
4315 def _update_impl(
4316 self, state: InstanceState[Any], revert_deletion: bool = False

Callers 1

_save_or_update_implMethod · 0.95

Calls 3

_before_attachMethod · 0.95
_after_attachMethod · 0.95
state_strFunction · 0.85

Tested by

no test coverage detected