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
)
| 721 | return data[0][column] |
| 722 | |
| 723 | async def fetchrow( |
| 724 | self, |
| 725 | query, |
| 726 | *args, |
| 727 | timeout=None, |
| 728 | record_class=None |
| 729 | ): |
| 730 | """Run a query and return the first row. |
| 731 | |
| 732 | :param str query: |
| 733 | Query text |
| 734 | :param args: |
| 735 | Query arguments |
| 736 | :param float timeout: |
| 737 | Optional timeout value in seconds. |
| 738 | :param type record_class: |
| 739 | If specified, the class to use for the value returned by this |
| 740 | method. Must be a subclass of :class:`~asyncpg.Record`. |
| 741 | If not specified, a per-connection *record_class* is used. |
| 742 | |
| 743 | :return: |
| 744 | The first row as a :class:`~asyncpg.Record` instance, or None if |
| 745 | no records were returned by the query. If specified, |
| 746 | *record_class* is used as the type for the result value. |
| 747 | |
| 748 | .. versionchanged:: 0.22.0 |
| 749 | Added the *record_class* parameter. |
| 750 | """ |
| 751 | self._check_open() |
| 752 | data = await self._execute( |
| 753 | query, |
| 754 | args, |
| 755 | 1, |
| 756 | timeout, |
| 757 | record_class=record_class, |
| 758 | ) |
| 759 | if not data: |
| 760 | return None |
| 761 | return data[0] |
| 762 | |
| 763 | async def fetchmany( |
| 764 | self, |
nothing calls this directly
no test coverage detected