MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / connect

Method connect

lib/sqlalchemy/ext/asyncio/engine.py:1090–1106  ·  view source on GitHub ↗

Return an :class:`_asyncio.AsyncConnection` object. The :class:`_asyncio.AsyncConnection` will procure a database connection from the underlying connection pool when it is entered as an async context manager:: async with async_engine.connect() as conn:

(self)

Source from the content-addressed store, hash-verified

1088 yield conn
1089
1090 def connect(self) -> AsyncConnection:
1091 """Return an :class:`_asyncio.AsyncConnection` object.
1092
1093 The :class:`_asyncio.AsyncConnection` will procure a database
1094 connection from the underlying connection pool when it is entered
1095 as an async context manager::
1096
1097 async with async_engine.connect() as conn:
1098 result = await conn.execute(select(user_table))
1099
1100 The :class:`_asyncio.AsyncConnection` may also be started outside of a
1101 context manager by invoking its :meth:`_asyncio.AsyncConnection.start`
1102 method.
1103
1104 """
1105
1106 return self._connection_cls(self)
1107
1108 async def raw_connection(self) -> PoolProxiedConnection:
1109 """Return a "raw" DBAPI connection from the connection pool.

Callers 5

beginMethod · 0.95
test_gc_connMethod · 0.95
connection_callableMethod · 0.45
creatorFunction · 0.45
prepareMethod · 0.45

Calls

no outgoing calls

Tested by 1

test_gc_connMethod · 0.76