()
| 852 | faker.make_records(20) |
| 853 | |
| 854 | async def work(): |
| 855 | async with await aconn_cls.connect(dsn) as conn: |
| 856 | async with conn.cursor(binary=fmt) as cur: |
| 857 | await cur.execute(faker.drop_stmt) |
| 858 | await cur.execute(faker.create_stmt) |
| 859 | async with faker.find_insert_problem_async(conn): |
| 860 | await cur.executemany(faker.insert_stmt, faker.records) |
| 861 | |
| 862 | stmt = sql.SQL( |
| 863 | "copy (select {} from {} order by id) to stdout (format {})" |
| 864 | ).format( |
| 865 | sql.SQL(", ").join(faker.fields_names), |
| 866 | faker.table_name, |
| 867 | sql.SQL(fmt.name), |
| 868 | ) |
| 869 | |
| 870 | async with cur.copy(stmt) as copy: |
| 871 | if set_types: |
| 872 | copy.set_types(faker.types_names) |
| 873 | |
| 874 | if method == "read": |
| 875 | while await copy.read(): |
| 876 | pass |
| 877 | elif method == "iter": |
| 878 | await alist(copy) |
| 879 | elif method == "row": |
| 880 | while (await copy.read_row()) is not None: |
| 881 | pass |
| 882 | elif method == "rows": |
| 883 | await alist(copy.rows()) |
| 884 | |
| 885 | gc.collect() |
| 886 | n = [] |
no test coverage detected