MCPcopy
hub / github.com/MagicStack/asyncpg / fetchval

Method fetchval

asyncpg/pool.py:636–648  ·  view source on GitHub ↗

Run a query and return a value in the first row. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetchval() `. .. versionadded:: 0.10.0

(self, query, *args, column=0, timeout=None)

Source from the content-addressed store, hash-verified

634 )
635
636 async def fetchval(self, query, *args, column=0, timeout=None):
637 """Run a query and return a value in the first row.
638
639 Pool performs this operation using one of its connections. Other than
640 that, it behaves identically to
641 :meth:`Connection.fetchval()
642 <asyncpg.connection.Connection.fetchval>`.
643
644 .. versionadded:: 0.10.0
645 """
646 async with self.acquire() as con:
647 return await con.fetchval(
648 query, *args, column=column, timeout=timeout)
649
650 async def fetchrow(self, query, *args, timeout=None, record_class=None):
651 """Run a query and return the first row.

Callers 2

startMethod · 0.45
can_be_usedFunction · 0.45

Calls 1

acquireMethod · 0.95

Tested by

no test coverage detected