Remove all object instances from this ``Session``. This is equivalent to calling ``expunge(obj)`` on all objects in this ``Session``.
(self)
| 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: |