Create a *prepared statement* for the specified query. :param str query: Text of the query to create a prepared statement for. :param str name: Optional name of the returned prepared statement. If not specified, the name is auto-generated.
(
self,
query,
*,
name=None,
timeout=None,
record_class=None,
)
| 627 | ) |
| 628 | |
| 629 | async def prepare( |
| 630 | self, |
| 631 | query, |
| 632 | *, |
| 633 | name=None, |
| 634 | timeout=None, |
| 635 | record_class=None, |
| 636 | ): |
| 637 | """Create a *prepared statement* for the specified query. |
| 638 | |
| 639 | :param str query: |
| 640 | Text of the query to create a prepared statement for. |
| 641 | :param str name: |
| 642 | Optional name of the returned prepared statement. If not |
| 643 | specified, the name is auto-generated. |
| 644 | :param float timeout: |
| 645 | Optional timeout value in seconds. |
| 646 | :param type record_class: |
| 647 | If specified, the class to use for records returned by the |
| 648 | prepared statement. Must be a subclass of |
| 649 | :class:`~asyncpg.Record`. If not specified, a per-connection |
| 650 | *record_class* is used. |
| 651 | |
| 652 | :return: |
| 653 | A :class:`~prepared_stmt.PreparedStatement` instance. |
| 654 | |
| 655 | .. versionchanged:: 0.22.0 |
| 656 | Added the *record_class* parameter. |
| 657 | |
| 658 | .. versionchanged:: 0.25.0 |
| 659 | Added the *name* parameter. |
| 660 | """ |
| 661 | return await self._prepare( |
| 662 | query, |
| 663 | name=name, |
| 664 | timeout=timeout, |
| 665 | record_class=record_class, |
| 666 | ) |
| 667 | |
| 668 | async def _prepare( |
| 669 | self, |
no test coverage detected