Skip to content

Awaiting multiple execute within a transaction seems to block forever #68

@seeker89

Description

@seeker89

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 !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions