Copy a list of records to the specified table using binary COPY. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_records_to_table() `.
(
self,
table_name,
*,
records,
columns=None,
schema_name=None,
timeout=None,
where=None
)
| 821 | ) |
| 822 | |
| 823 | async def copy_records_to_table( |
| 824 | self, |
| 825 | table_name, |
| 826 | *, |
| 827 | records, |
| 828 | columns=None, |
| 829 | schema_name=None, |
| 830 | timeout=None, |
| 831 | where=None |
| 832 | ): |
| 833 | """Copy a list of records to the specified table using binary COPY. |
| 834 | |
| 835 | Pool performs this operation using one of its connections. Other than |
| 836 | that, it behaves identically to |
| 837 | :meth:`Connection.copy_records_to_table() |
| 838 | <asyncpg.connection.Connection.copy_records_to_table>`. |
| 839 | |
| 840 | .. versionadded:: 0.24.0 |
| 841 | """ |
| 842 | async with self.acquire() as con: |
| 843 | return await con.copy_records_to_table( |
| 844 | table_name, |
| 845 | records=records, |
| 846 | columns=columns, |
| 847 | schema_name=schema_name, |
| 848 | timeout=timeout, |
| 849 | where=where |
| 850 | ) |
| 851 | |
| 852 | def acquire(self, *, timeout=None): |
| 853 | """Acquire a database connection from the pool. |