Return a *cursor factory* for the specified query. :param args: Query arguments. :param int prefetch: The number of rows the *cursor iterator* will prefetch (defaults to ``50``.) :param float timeout: Optional timeout in second
(
self,
query,
*args,
prefetch=None,
timeout=None,
record_class=None
)
| 588 | return rows[0] |
| 589 | |
| 590 | def cursor( |
| 591 | self, |
| 592 | query, |
| 593 | *args, |
| 594 | prefetch=None, |
| 595 | timeout=None, |
| 596 | record_class=None |
| 597 | ): |
| 598 | """Return a *cursor factory* for the specified query. |
| 599 | |
| 600 | :param args: |
| 601 | Query arguments. |
| 602 | :param int prefetch: |
| 603 | The number of rows the *cursor iterator* |
| 604 | will prefetch (defaults to ``50``.) |
| 605 | :param float timeout: |
| 606 | Optional timeout in seconds. |
| 607 | :param type record_class: |
| 608 | If specified, the class to use for records returned by this cursor. |
| 609 | Must be a subclass of :class:`~asyncpg.Record`. If not specified, |
| 610 | a per-connection *record_class* is used. |
| 611 | |
| 612 | :return: |
| 613 | A :class:`~cursor.CursorFactory` object. |
| 614 | |
| 615 | .. versionchanged:: 0.22.0 |
| 616 | Added the *record_class* parameter. |
| 617 | """ |
| 618 | self._check_open() |
| 619 | return cursor.CursorFactory( |
| 620 | self, |
| 621 | query, |
| 622 | None, |
| 623 | args, |
| 624 | prefetch, |
| 625 | timeout, |
| 626 | record_class, |
| 627 | ) |
| 628 | |
| 629 | async def prepare( |
| 630 | self, |