#34009: migrations.RunPython runs queries against wrong database
--------------------------------+--------------------------------------
Reporter: Marcel Moreaux | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Comment (by Alex Morega):
A quick search turned up this bit of the docs:
https://docs.djangoproject.com/en/4.1/howto/writing-migrations/#data-
migrations-and-multiple-databases
>In order to do that you can check the database connection’s alias inside
a RunPython operation by looking at the schema_editor.connection.alias
attribute
So, IIUC, you're supposed to select the database yourself in a RunPython
operation. Or maybe I've missed something entirely, in which case, I
apologise :)
--
Ticket URL: <https://code.djangoproject.com/ticket/34009#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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701833bd6e66f-4d225b08-02c6-446e-9db6-782d8820a33f-000000%40eu-central-1.amazonses.com.