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

Method remove

lib/sqlalchemy/orm/scoping.py:244–259  ·  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

242 self.session_factory.configure(**kwargs)
243
244 def remove(self) -> None:
245 """Dispose of the current :class:`.Session`, if present.
246
247 This will first call :meth:`.Session.close` method
248 on the current :class:`.Session`, which releases any existing
249 transactional/connection resources still being held; transactions
250 specifically are rolled back. The :class:`.Session` is then
251 discarded. Upon next usage within the same scope,
252 the :class:`.scoped_session` will produce a new
253 :class:`.Session` object.
254
255 """
256
257 if self.registry.has():
258 self.registry().close()
259 self.registry.clear()
260
261 def query_property(
262 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