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

Method fetch_one

ormar/databases/query_executor.py:37–46  ·  view source on GitHub ↗

Execute a query and fetch one row. :param query: SQLAlchemy query expression :return: Single Row object or None

(self, query: Executable)

Source from the content-addressed store, hash-verified

35 return list(result.mappings().all())
36
37 async def fetch_one(self, query: Executable) -> Optional[RowMapping]:
38 """
39 Execute a query and fetch one row.
40
41 :param query: SQLAlchemy query expression
42 :return: Single Row object or None
43 """
44 result: CursorResult[Any] = await self._connection.execute(query)
45 row = result.mappings().first()
46 return row
47
48 async def fetch_val(self, query: Executable, column: int = 0) -> Optional[Any]:
49 """

Callers 2

_query_aggr_functionMethod · 0.80
_execute_queryMethod · 0.80

Calls 2

executeMethod · 0.80
firstMethod · 0.45

Tested by

no test coverage detected