In the documentation for select_for_update
<https://docs.djangoproject.com/en/2.1/ref/models/querysets/#select-for-update>,
given code example is:
from django.db import transaction
entries = Entry.objects.select_for_update().filter(author=request.user)with
transaction.atomic():
for entry in entries:
...
At the same time, below in the description it says that:
*Evaluating a queryset with select_for_update() in autocommit mode on
backends which support SELECT ... FOR UPDATE is a
TransactionManagementError
<https://docs.djangoproject.com/en/2.1/ref/exceptions/#django.db.transaction.TransactionManagementError>
error because the
rows are not locked in that case.*
*Does this mean that the above code example will raise
**TransactionManagementError , since the select_for_update_query is
evaluated outside atomic block?*
*(I have'nt actually tried this out yet, will soon. I think may be a
correction is required in the code example)*
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAFkxFaGcNMbaruWOoWBk%2BPVjyB9jZOY%2Bhm-677a3CvfJmESQrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.