MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / run

Method run

tests/test_copy.py:734–750  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

732 records=async_records() if asynchronous else records())
733
734 async def run():
735 await con.execute('CREATE TEMP TABLE copytab (a bytea)')
736 with self.assertRaises(ValueError) as caught:
737 if transaction:
738 async with con.transaction():
739 await copy()
740 else:
741 await copy()
742 self.assertIs(caught.exception, error)
743 self.assertFalse(con.is_in_transaction())
744 self.assertEqual(
745 await con.fetchval('SELECT count(*) FROM copytab'), 0)
746 self.assertEqual(await con.copy_records_to_table(
747 'copytab', records=[(b'recovered',)]), 'COPY 1')
748 self.assertEqual(
749 await con.fetchval('SELECT a FROM copytab'), b'recovered')
750 await con.close()
751
752 try:
753 # Bound recovery and close as well as COPY itself: cancellation

Callers

nothing calls this directly

Calls 6

transactionMethod · 0.80
is_in_transactionMethod · 0.80
executeMethod · 0.45
fetchvalMethod · 0.45
copy_records_to_tableMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected