0

I recently came across nested atomic blocks in Django and it looks like even if error occurs in any of those blocks, all of them will be rollbacked. So, why do people use nested atomic block?

Specifically, what is the difference between

with transaction.atomic():
    do_something

    with transaction.atomic():
        do_something_more

and

with transaction.atomic():
    do_something

    do_something_more

? If there is no overall difference, then in what scenario first should be used instead of second?

Gaurav Jha
  • 161
  • 1
  • 7

0 Answers0