#25172: System check is failing on multi-database setup with different backends
-------------------------------------+-------------------------------------
Reporter: delinhabit | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (System | Version: 1.7
checks) | Keywords: system-checks multi-
Severity: Normal | database
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
We have the following database set-up:
* the default database is MySQL
* two additional databases are PostGIS
The system check framework (either `manage.py check` or `manage.py
runserver`) is using the default database (mysql) to validate
`django.contrib.gis.db.models.Model`-based models, and the commands are
blowing up with the following error:
AttributeError: 'DatabaseOperations' object has no attribute
'geo_db_type'.
We set-up database routers for the PostGIS models to use the proper
connection, but the check framework seems to ignore them.
You can find the detailed stack trace here:
https://gist.github.com/delinhabit/587d6f26afb4bbc559cb
The discussion that led to this ticket:
https://groups.google.com/forum/#!msg/django-
developers/_QUT4hV43YE/b-1eTcv_5yUJ
I can try to create a PR, though I'm not sure where to start. Specifically
my questions are:
* What tests case file should I extend with a regression tests? The
`tests/multiple_database` doesn't test any system checks at all.
`tests/system_check` could be a candidate but I need a multiple database
set-up and it doesn't feel right to change that test app. Should I better
create a new test app for this use case?
* I think `Field._check_backend_specific_checks` should be the place, only
that at that point it already uses connection and I'm not sure how can I
detect what connection should I use from the field instance (or the
associated model). Should I run the Database routing code to get the
connection alias? (seems a little gross to me)
Any feedback appreciated.
Thanks,
Ion
--
Ticket URL: <https://code.djangoproject.com/ticket/25172>
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/053.d0af47d621ed94052266224040117b5a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.