MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / expunge_all

Method expunge_all

lib/sqlalchemy/orm/session.py:2694–2708  ·  view source on GitHub ↗

Remove all object instances from this ``Session``. This is equivalent to calling ``expunge(obj)`` on all objects in this ``Session``.

(self)

Source from the content-addressed store, hash-verified

2692 transaction.close(invalidate)
2693
2694 def expunge_all(self) -> None:
2695 """Remove all object instances from this ``Session``.
2696
2697 This is equivalent to calling ``expunge(obj)`` on all objects in this
2698 ``Session``.
2699
2700 """
2701
2702 all_states = self.identity_map.all_states() + list(self._new)
2703 self.identity_map._kill()
2704 self.identity_map = identity._WeakInstanceDict()
2705 self._new = {}
2706 self._deleted = {}
2707
2708 statelib.InstanceState._detach_states(all_states, self)
2709
2710 def _add_bind(self, key: _SessionBindKey, bind: _SessionBind) -> None:
2711 try:

Callers 15

_close_implMethod · 0.95
test_basicMethod · 0.95
goMethod · 0.95
scoped_session.pyFile · 0.45
test_append_reorderMethod · 0.45
test_insertMethod · 0.45
test_sliceMethod · 0.45
test_replaceMethod · 0.45
roundtripMethod · 0.45

Calls 3

_killMethod · 0.80
_detach_statesMethod · 0.80
all_statesMethod · 0.45

Tested by 15

test_basicMethod · 0.76
goMethod · 0.76
test_append_reorderMethod · 0.36
test_insertMethod · 0.36
test_sliceMethod · 0.36
test_replaceMethod · 0.36
roundtripMethod · 0.36
roundtripMethod · 0.36
roundtripMethod · 0.36
test_get_baked_queryMethod · 0.36