(self)
| 460 | await self.con.execute('DROP TABLE public.copytab') |
| 461 | |
| 462 | async def test_copy_to_table_large_rows(self): |
| 463 | await self.con.execute(''' |
| 464 | CREATE TABLE copytab(a text, b text); |
| 465 | ''') |
| 466 | |
| 467 | try: |
| 468 | class _Source: |
| 469 | def __init__(self): |
| 470 | self.rowcount = 0 |
| 471 | |
| 472 | def __aiter__(self): |
| 473 | return self |
| 474 | |
| 475 | async def __anext__(self): |
| 476 | if self.rowcount >= 100: |
| 477 | raise StopAsyncIteration |
| 478 | else: |
| 479 | self.rowcount += 1 |
| 480 | return b'a1' * 500000 + b'\t' + b'b1' * 500000 + b'\n' |
| 481 | |
| 482 | res = await self.con.copy_to_table('copytab', source=_Source()) |
| 483 | |
| 484 | self.assertEqual(res, 'COPY 100') |
| 485 | |
| 486 | finally: |
| 487 | await self.con.execute('DROP TABLE copytab') |
| 488 | |
| 489 | async def test_copy_to_table_from_bytes_like(self): |
| 490 | await self.con.execute(''' |
nothing calls this directly
no test coverage detected