-   Notifications  You must be signed in to change notification settings 
- Fork 435
Closed
Labels
Description
I'm trying to execute a couple of sql queries with arguments, in a context of a transaction.
I used this code:
 async def execute_many_in_transaction(self, queries_and_args): pool = await get_pool() # returns a pool of clients async with pool.acquire() as connection: async with connection.transaction(): for query, args in queries_and_args: await connection.execute( query, *args )When I call it with a list with one tuple [("SQL STATEMENT", [arg1, arg2])] all is good.
The moment I try to execute more than one, it just hangs there forever. For example:
[ ("SQL STATEMENT 1", [arg1, arg2]), ("SQL STATEMENT 2", [arg1, arg3]), ]I know that there is execute_many method, but that only seems to work on the same sql statement with multiple lists of arguments.
Is there something I'm misunderstanding ?
Thanks !