MCPcopy
hub / github.com/ormar-orm/ormar / connection

Method connection

ormar/databases/connection.py:111–121  ·  view source on GitHub ↗

Get a connection from the pool. If inside a transaction, returns the transaction connection.

(self)

Source from the content-addressed store, hash-verified

109
110 @asynccontextmanager
111 async def connection(self) -> AsyncIterator[AsyncConnection]:
112 """
113 Get a connection from the pool.
114 If inside a transaction, returns the transaction connection.
115 """
116 trans_conn = _transaction_connection.get()
117 if trans_conn is not None:
118 yield trans_conn
119 else:
120 async with self.engine.connect() as conn:
121 yield conn
122
123 def transaction(self, force_rollback: bool = False) -> Transaction:
124 """

Calls 2

getMethod · 0.45
connectMethod · 0.45