MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / remove

Method remove

lib/sqlalchemy/orm/scoping.py:254–269  ·  view source on GitHub ↗

Dispose of the current :class:`.Session`, if present. This will first call :meth:`.Session.close` method on the current :class:`.Session`, which releases any existing transactional/connection resources still being held; transactions specifically are rolled back. The

(self)

Source from the content-addressed store, hash-verified

252 self.session_factory.configure(**kwargs)
253
254 def remove(self) -> None:
255 """Dispose of the current :class:`.Session`, if present.
256
257 This will first call :meth:`.Session.close` method
258 on the current :class:`.Session`, which releases any existing
259 transactional/connection resources still being held; transactions
260 specifically are rolled back. The :class:`.Session` is then
261 discarded. Upon next usage within the same scope,
262 the :class:`.scoped_session` will produce a new
263 :class:`.Session` object.
264
265 """
266
267 if self.registry.has():
268 self.registry().close()
269 self.registry.clear()
270
271 def query_property(
272 self, query_cls: Optional[Type[Query[_T]]] = None

Callers

nothing calls this directly

Calls 4

registryMethod · 0.80
hasMethod · 0.45
closeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected