Run a query and return the results as a list of :class:`Record`. :param str query: Query text. :param args: Query arguments. :param float timeout: Optional timeout value in seconds. :param type record_class: If specifie
(
self,
query,
*args,
timeout=None,
record_class=None
)
| 687 | return prepared_stmt.PreparedStatement(self, query, stmt) |
| 688 | |
| 689 | async def fetch( |
| 690 | self, |
| 691 | query, |
| 692 | *args, |
| 693 | timeout=None, |
| 694 | record_class=None |
| 695 | ) -> list: |
| 696 | """Run a query and return the results as a list of :class:`Record`. |
| 697 | |
| 698 | :param str query: |
| 699 | Query text. |
| 700 | :param args: |
| 701 | Query arguments. |
| 702 | :param float timeout: |
| 703 | Optional timeout value in seconds. |
| 704 | :param type record_class: |
| 705 | If specified, the class to use for records returned by this method. |
| 706 | Must be a subclass of :class:`~asyncpg.Record`. If not specified, |
| 707 | a per-connection *record_class* is used. |
| 708 | |
| 709 | :return list: |
| 710 | A list of :class:`~asyncpg.Record` instances. If specified, the |
| 711 | actual type of list elements would be *record_class*. |
| 712 | |
| 713 | .. versionchanged:: 0.22.0 |
| 714 | Added the *record_class* parameter. |
| 715 | """ |
| 716 | self._check_open() |
| 717 | return await self._execute( |
| 718 | query, |
| 719 | args, |
| 720 | 0, |
| 721 | timeout, |
| 722 | record_class=record_class, |
| 723 | ) |
| 724 | |
| 725 | async def fetchval(self, query, *args, column=0, timeout=None): |
| 726 | """Run a query and return a value in the first row. |
no test coverage detected