gino icon indicating copy to clipboard operation
gino copied to clipboard

Docs are fixed, but there's a big piece missing on Manual Transactions

Open mikepc opened this issue 6 years ago • 2 comments

Regarding https://github.com/fantix/gino/issues/511

Exactly what syntax is used to get the "connection" that will allow the documented code to function?

Changing the doc to the correct syntax without retrofitting the docs to make the code work is a bit rough.

mikepc avatar Sep 09 '19 00:09 mikepc

    async with db.transaction() as tx_root:
        conn = tx_root.connection
        tx = await conn.transaction()
        try:
            people.hr["applications"].append(gapp)
            await tx.commit()
        except Exception:
            await tx.rollback()

mikepc avatar Sep 09 '19 00:09 mikepc

Connection part is covered in another chapter http://gino.fantix.pro/en/latest/engine.html#managing-connections, but yeah we can also include that here.

wwwjfy avatar Sep 09 '19 14:09 wwwjfy