#34091: Invalid SQL: FROM clauses can be omitted when QuerySet is accessed from
multiple threads
-------------------------------------+-------------------------------------
     Reporter:  Marti Raudsepp       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  4.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:  race-condition,      |             Triage Stage:
  orm, threading, SQLCompiler        |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Marti Raudsepp):

 > Django doesn't provide any thread safety guarantees for ORM objects
 (model instances, querysets) and it's your responsibility

 Do document this! Most Django APIs seem to be thread-safe, how is a user
 supposed to know, where the limits of thread (un)safety are?

 > make sure ​they create copies of the references before manipulating
 them.

 So `QuerySet.all()` is thread-safe, but ''iterating'' over QuerySet is
 not? How is one supposed to know?

 Before investigating this, I explicitly searched to figure out whether
 QuerySets are thread safe, the only result that was sort-of authoritative
 was https://code.djangoproject.com/ticket/11906 and since it's marked as
 "fixed", it looked like this API aims to support thread safety.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34091#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183d1fbcaca-c7939c8a-165f-4bf8-a746-a9e4e38e9816-000000%40eu-central-1.amazonses.com.

Reply via email to