#34009: migrations.RunPython runs queries against wrong database
--------------------------------+--------------------------------------
     Reporter:  Marcel Moreaux  |                    Owner:  nobody
         Type:  Uncategorized   |                   Status:  closed
    Component:  Uncategorized   |                  Version:  4.1
     Severity:  Normal          |               Resolution:  invalid
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 > I maintain this is a bug, so I'm reopening this ticket.

 It's not a bug but a [https://docs.djangoproject.com/en/stable/ref
 /migration-operations/#runpython documented behavior]:

 > ''"RunPython **does not magically alter the connection of the models for
 you; any model methods you call will go to the default database unless**
 you give them the current database alias (available from
 schema_editor.connection.alias, where schema_editor is the second argument
 to your function)."''

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34009#comment:4>
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/010701833caa9149-b9740084-83e8-4579-8bd7-80afb569d889-000000%40eu-central-1.amazonses.com.

Reply via email to