Skip to content

Commit 7eec0df

Browse files
committed
Add record_class parameter Pool.fetch and Pool.fetchrow
1 parent a2f093d commit 7eec0df

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

asyncpg/pool.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,13 @@ async def executemany(self, command: str, args, *, timeout: float=None):
576576
async with self.acquire() as con:
577577
return await con.executemany(command, args, timeout=timeout)
578578

579-
async def fetch(self, query, *args, timeout=None) -> list:
579+
async def fetch(
580+
self,
581+
query,
582+
*args,
583+
timeout=None,
584+
record_class=None
585+
) -> list:
580586
"""Run a query and return the results as a list of :class:`Record`.
581587
582588
Pool performs this operation using one of its connections. Other than
@@ -586,7 +592,12 @@ async def fetch(self, query, *args, timeout=None) -> list:
586592
.. versionadded:: 0.10.0
587593
"""
588594
async with self.acquire() as con:
589-
return await con.fetch(query, *args, timeout=timeout)
595+
return await con.fetch(
596+
query,
597+
*args,
598+
timeout=timeout,
599+
record_class=record_class
600+
)
590601

591602
async def fetchval(self, query, *args, column=0, timeout=None):
592603
"""Run a query and return a value in the first row.
@@ -602,7 +613,7 @@ async def fetchval(self, query, *args, column=0, timeout=None):
602613
return await con.fetchval(
603614
query, *args, column=column, timeout=timeout)
604615

605-
async def fetchrow(self, query, *args, timeout=None):
616+
async def fetchrow(self, query, *args, timeout=None, record_class=None):
606617
"""Run a query and return the first row.
607618
608619
Pool performs this operation using one of its connections. Other than
@@ -612,7 +623,12 @@ async def fetchrow(self, query, *args, timeout=None):
612623
.. versionadded:: 0.10.0
613624
"""
614625
async with self.acquire() as con:
615-
return await con.fetchrow(query, *args, timeout=timeout)
626+
return await con.fetchrow(
627+
query,
628+
*args,
629+
timeout=timeout,
630+
record_class=record_class
631+
)
616632

617633
async def copy_from_table(
618634
self,

0 commit comments

Comments
 (0)