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

Method __call__

lib/sqlalchemy/ext/asyncio/session.py:1803–1821  ·  view source on GitHub ↗

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

(self, **local_kw: Any)

Source from the content-addressed store, hash-verified

1801 return session._maker_context_manager()
1802
1803 def __call__(self, **local_kw: Any) -> _AS:
1804 """Produce a new :class:`.AsyncSession` object using the configuration
1805 established in this :class:`.async_sessionmaker`.
1806
1807 In Python, the ``__call__`` method is invoked on an object when
1808 it is "called" in the same way as a function::
1809
1810 AsyncSession = async_sessionmaker(async_engine, expire_on_commit=False)
1811 session = AsyncSession() # invokes sessionmaker.__call__()
1812
1813 """ # noqa E501
1814 for k, v in self.kw.items():
1815 if k == "info" and "info" in local_kw:
1816 d = v.copy()
1817 d.update(local_kw["info"])
1818 local_kw["info"] = d
1819 else:
1820 local_kw.setdefault(k, v)
1821 return self.class_(**local_kw)
1822
1823 def configure(self, **new_kw: Any) -> None:
1824 """(Re)configure the arguments for this async_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