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

Method fetch_val

ormar/databases/query_executor.py:48–57  ·  view source on GitHub ↗

Execute a query and fetch a single scalar value. :param query: SQLAlchemy query expression :param column: Column index to fetch (default 0) :return: Scalar value or None

(self, query: Executable, column: int = 0)

Source from the content-addressed store, hash-verified

46 return row
47
48 async def fetch_val(self, query: Executable, column: int = 0) -> Optional[Any]:
49 """
50 Execute a query and fetch a single scalar value.
51
52 :param query: SQLAlchemy query expression
53 :param column: Column index to fetch (default 0)
54 :return: Scalar value or None
55 """
56 result: CursorResult[Any] = await self._connection.execute(query)
57 return result.scalar()
58
59 async def execute(self, query: Executable) -> Any:
60 """

Callers 2

existsMethod · 0.80
countMethod · 0.80

Calls 1

executeMethod · 0.80

Tested by

no test coverage detected