Django transaction is splitted, even if I use transaction.atomic()
with transaction.atomic():
A.objects.filter(
a=a,
b=b,
c=c,
d__range=[start_date, end_date],
).delete()
A.objects.bulk_create(
[
A(
a=a,
b=b,
c=c,
d=d,
e=e,
f=f,
g=g,
)
for obj in objs
]
)
Query is like
BEGIN BEGIN DELETE FROM ... COMMIT BEGIN INSERT INTO ... COMMIT
What I want to do
BEGIN DELETE FROM ... INSERT INTO COMMIT