Search code examples
pythonsqlasynchronousasync-awaitwith-statement

Will `async with` containing multiple statements execute them synchronously?


I'm using aiosqlite library and am wondering if the following code will execute inserts in order or asynchronously?

async with (
    db.execute("INSERT ..."),
    db.execute("INSERT ..."),
):
    pass

I'm guessing in order?


Solution

  • As per Barmar's comment, they will indeed execute in order.