Ability to skip nested transactions

I think you want atomic(savepoint=False) ? This disables creating of savepoints if already inside a transaction.

Per docs:

You can disable the creation of savepoints for inner blocks by setting the savepoint argument to False . If an exception occurs, Django will perform the rollback when exiting the first parent block with a savepoint if there is one, and the outermost block otherwise. Atomicity is still guaranteed by the outer transaction. This option should only be used if the overhead of savepoints is noticeable. It has the drawback of breaking the error handling described above.

1 Like