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

Method _save_impl

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

Source from the content-addressed store, hash-verified

4142 )
4143
4144 def _save_impl(self, state: InstanceState[Any]) -> None:
4145 if state.key is not None:
4146 raise sa_exc.InvalidRequestError(
4147 "Object '%s' already has an identity - "
4148 "it can't be registered as pending" % state_str(state)
4149 )
4150
4151 obj = state.obj()
4152 to_attach = self._before_attach(state, obj)
4153 if state not in self._new:
4154 self._new[state] = obj
4155 state.insert_order = len(self._new)
4156 if to_attach:
4157 self._after_attach(state, obj)
4158
4159 def _update_impl(
4160 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