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
)
| 664 | return prepared_stmt.PreparedStatement(self, query, stmt) |
| 665 | |
| 666 | async def fetch( |
| 667 | self, |
| 668 | query, |
| 669 | *args, |
| 670 | timeout=None, |
| 671 | record_class=None |
| 672 | ) -> list: |
| 673 | """Run a query and return the results as a list of :class:`Record`. |
| 674 | |
| 675 | :param str query: |
| 676 | Query text. |
| 677 | :param args: |
| 678 | Query arguments. |
| 679 | :param float timeout: |
| 680 | Optional timeout value in seconds. |
| 681 | :param type record_class: |
| 682 | If specified, the class to use for records returned by this method. |
| 683 | Must be a subclass of :class:`~asyncpg.Record`. If not specified, |
| 684 | a per-connection *record_class* is used. |
| 685 | |
| 686 | :return list: |
| 687 | A list of :class:`~asyncpg.Record` instances. If specified, the |
| 688 | actual type of list elements would be *record_class*. |
| 689 | |
| 690 | .. versionchanged:: 0.22.0 |
| 691 | Added the *record_class* parameter. |
| 692 | """ |
| 693 | self._check_open() |
| 694 | return await self._execute( |
| 695 | query, |
| 696 | args, |
| 697 | 0, |
| 698 | timeout, |
| 699 | record_class=record_class, |
| 700 | ) |
| 701 | |
| 702 | async def fetchval(self, query, *args, column=0, timeout=None): |
| 703 | """Run a query and return a value in the first row. |
no test coverage detected