(args: Namespace)
| 47 | |
| 48 | |
| 49 | async def main_async(args: Namespace) -> None: |
| 50 | test = CopyPutTest(args) |
| 51 | async with await psycopg.AsyncConnection.connect(args.dsn) as conn: |
| 52 | async with conn.cursor() as cur: |
| 53 | await cur.execute(test.get_table_stmt()) |
| 54 | writer = getattr(psycopg.copy, args.writer)(cur) if args.writer else None |
| 55 | t0 = time() |
| 56 | async with cur.copy(test.get_copy_stmt(), writer=writer) as copy: |
| 57 | for i in range(args.nrecs): |
| 58 | await copy.write_row(test.get_record()) |
| 59 | tf = time() |
| 60 | |
| 61 | logger.info("time to copy: %.6f sec", tf - t0) |
| 62 | |
| 63 | |
| 64 | class CopyPutTest: |
no test coverage detected