#26273: Module level queries in a project can crash migrations if the queried 
model
schema changed.
-------------------------------------+-------------------------------------
     Reporter:  scoenye              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Uncategorized        |                  Version:  1.9
     Severity:  Normal               |               Resolution:
     Keywords:  classmethod          |             Triage Stage:
  queryset manage.py                 |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by charettes):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * needs_tests:   => 0


Comment:

 Hi scoenye,

 From what I can see this has not much to do with migrations but is related
 to the fact you should never execute queries at module level.

 This is related to #25454 and probably a large number of closed tickets.

 I wonder if should simply prevent `django.db` from executing queries until
 `django.apps.apps.ready` or at least issue a `RuntimeWarning`.

 We would have to go through deprecation but I'm pretty sure this would
 uncover a lot of existing application bugs and prevent future ones.

--
Ticket URL: <https://code.djangoproject.com/ticket/26273#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.4739e60a88b4cfa0123cb67409388f06%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to