fastapi_production_template
fastapi_production_template copied to clipboard
how exactly can I use the commit_after flag and is this a way to deal with Transactions?
can you please explain a bit about the commit_after flag? Furthermore, how do I deal with rollbacks in case an exception occurs in the service layer?
query: Select | Insert | Update,
connection: AsyncConnection,
commit_after: bool = False,
) -> CursorResult:
result = await connection.execute(query)
if commit_after:
await connection.commit()
return result
do the db changes not get committed if I set commit_after to False?
Thank you so much.