MCPcopy
hub / github.com/psycopg/psycopg / inserted

Function inserted

tests/_test_transaction.py:37–51  ·  view source on GitHub ↗

Return the values inserted in the test table.

(conn)

Source from the content-addressed store, hash-verified

35
36
37def inserted(conn):
38 """Return the values inserted in the test table."""
39 sql = "SELECT * FROM test_table"
40 if isinstance(conn, psycopg.Connection):
41 rows = conn.cursor().execute(sql).fetchall()
42 return {v for (v,) in rows}
43 else:
44
45 async def f():
46 cur = conn.cursor()
47 await cur.execute(sql)
48 rows = await cur.fetchall()
49 return {v for (v,) in rows}
50
51 return f()
52
53
54def in_transaction(conn):

Calls 4

fFunction · 0.70
fetchallMethod · 0.45
executeMethod · 0.45
cursorMethod · 0.45

Tested by

no test coverage detected