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

Method fetch

asyncpg/pool.py:613–634  ·  view source on GitHub ↗

Run a query and return the results as a list of :class:`Record`. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetch() `. .. versionadded:: 0.10.0

(
        self,
        query,
        *args,
        timeout=None,
        record_class=None
    )

Source from the content-addressed store, hash-verified

611 return await con.executemany(command, args, timeout=timeout)
612
613 async def fetch(
614 self,
615 query,
616 *args,
617 timeout=None,
618 record_class=None
619 ) -> list:
620 """Run a query and return the results as a list of :class:`Record`.
621
622 Pool performs this operation using one of its connections. Other than
623 that, it behaves identically to
624 :meth:`Connection.fetch() <asyncpg.connection.Connection.fetch>`.
625
626 .. versionadded:: 0.10.0
627 """
628 async with self.acquire() as con:
629 return await con.fetch(
630 query,
631 *args,
632 timeout=timeout,
633 record_class=record_class
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.

Callers 15

runnerFunction · 0.45
test_compositesMethod · 0.45
test_range_typesMethod · 0.45
test_multirange_typesMethod · 0.45
test_enumMethod · 0.45

Calls 1

acquireMethod · 0.95

Tested by 15

test_compositesMethod · 0.36
test_range_typesMethod · 0.36
test_multirange_typesMethod · 0.36
test_enumMethod · 0.36