Run a query and return the first row. :param str query: Query text :param args: Query arguments :param float timeout: Optional timeout value in seconds. :param type record_class: If specified, the class to use for the v
(
self,
query,
*args,
timeout=None,
record_class=None
)
| 744 | return data[0][column] |
| 745 | |
| 746 | async def fetchrow( |
| 747 | self, |
| 748 | query, |
| 749 | *args, |
| 750 | timeout=None, |
| 751 | record_class=None |
| 752 | ): |
| 753 | """Run a query and return the first row. |
| 754 | |
| 755 | :param str query: |
| 756 | Query text |
| 757 | :param args: |
| 758 | Query arguments |
| 759 | :param float timeout: |
| 760 | Optional timeout value in seconds. |
| 761 | :param type record_class: |
| 762 | If specified, the class to use for the value returned by this |
| 763 | method. Must be a subclass of :class:`~asyncpg.Record`. |
| 764 | If not specified, a per-connection *record_class* is used. |
| 765 | |
| 766 | :return: |
| 767 | The first row as a :class:`~asyncpg.Record` instance, or None if |
| 768 | no records were returned by the query. If specified, |
| 769 | *record_class* is used as the type for the result value. |
| 770 | |
| 771 | .. versionchanged:: 0.22.0 |
| 772 | Added the *record_class* parameter. |
| 773 | """ |
| 774 | self._check_open() |
| 775 | data = await self._execute( |
| 776 | query, |
| 777 | args, |
| 778 | 1, |
| 779 | timeout, |
| 780 | record_class=record_class, |
| 781 | ) |
| 782 | if not data: |
| 783 | return None |
| 784 | return data[0] |
| 785 | |
| 786 | async def fetchmany( |
| 787 | self, |
nothing calls this directly
no test coverage detected