MCPcopy
hub / github.com/psycopg/psycopg / main_sync

Function main_sync

tests/scripts/copytest.py:34–46  ·  view source on GitHub ↗
(args: Namespace)

Source from the content-addressed store, hash-verified

32
33
34def main_sync(args: Namespace) -> None:
35 test = CopyPutTest(args)
36 with psycopg.Connection.connect(args.dsn) as conn:
37 with conn.cursor() as cur:
38 writer = getattr(psycopg.copy, args.writer)(cur) if args.writer else None
39 cur.execute(test.get_table_stmt())
40 t0 = time()
41 with cur.copy(test.get_copy_stmt(), writer=writer) as copy:
42 for i in range(args.nrecs):
43 copy.write_row(test.get_record())
44 tf = time()
45
46 logger.info("time to copy: %.6f sec", tf - t0)
47
48
49async def main_async(args: Namespace) -> None:

Callers 1

mainFunction · 0.85

Calls 10

get_table_stmtMethod · 0.95
get_copy_stmtMethod · 0.95
get_recordMethod · 0.95
CopyPutTestClass · 0.85
connectMethod · 0.45
cursorMethod · 0.45
executeMethod · 0.45
copyMethod · 0.45
write_rowMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected