MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __call__

Method __call__

lib/sqlalchemy/orm/session.py:5291–5309  ·  view source on GitHub ↗

Produce a new :class:`.Session` object using the configuration established in this :class:`.sessionmaker`. In Python, the ``__call__`` method is invoked on an object when it is "called" in the same way as a function:: Session = sessionmaker(some_engine)

(self, **local_kw: Any)

Source from the content-addressed store, hash-verified

5289 return session._maker_context_manager()
5290
5291 def __call__(self, **local_kw: Any) -> _S:
5292 """Produce a new :class:`.Session` object using the configuration
5293 established in this :class:`.sessionmaker`.
5294
5295 In Python, the ``__call__`` method is invoked on an object when
5296 it is "called" in the same way as a function::
5297
5298 Session = sessionmaker(some_engine)
5299 session = Session() # invokes sessionmaker.__call__()
5300
5301 """
5302 for k, v in self.kw.items():
5303 if k == "info" and "info" in local_kw:
5304 d = v.copy()
5305 d.update(local_kw["info"])
5306 local_kw["info"] = d
5307 else:
5308 local_kw.setdefault(k, v)
5309 return self.class_(**local_kw)
5310
5311 def configure(self, **new_kw: Any) -> None:
5312 """(Re)configure the arguments for this sessionmaker.

Callers

nothing calls this directly

Calls 5

class_Method · 0.80
itemsMethod · 0.45
copyMethod · 0.45
updateMethod · 0.45
setdefaultMethod · 0.45

Tested by

no test coverage detected