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
)
| 938 | ) |
| 939 | |
| 940 | async def copy_records_to_table( |
| 941 | self, |
| 942 | table_name, |
| 943 | *, |
| 944 | records, |
| 945 | columns=None, |
| 946 | schema_name=None, |
| 947 | timeout=None, |
| 948 | where=None |
| 949 | ): |
| 950 | """Copy a list of records to the specified table using binary COPY. |
| 951 | |
| 952 | Pool performs this operation using one of its connections. Other than |
| 953 | that, it behaves identically to |
| 954 | :meth:`Connection.copy_records_to_table() |
| 955 | <asyncpg.connection.Connection.copy_records_to_table>`. |
| 956 | |
| 957 | .. versionadded:: 0.24.0 |
| 958 | """ |
| 959 | async with self.acquire() as con: |
| 960 | return await con.copy_records_to_table( |
| 961 | table_name, |
| 962 | records=records, |
| 963 | columns=columns, |
| 964 | schema_name=schema_name, |
| 965 | timeout=timeout, |
| 966 | where=where |
| 967 | ) |
| 968 | |
| 969 | def acquire(self, *, timeout=None): |
| 970 | """Acquire a database connection from the pool. |