#27180: Check for sql_mode fails during migration with special database
connections
----------------------------+--------------------
Reporter: gerricom | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
I believe I found again a bug regarding some special database connections
(like #26991):
Running `migrate` raises this error:
{{{
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-
packages/django/core/management/__init__.py", line 367, in
execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-
packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-
packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/site-
packages/django/core/management/base.py", line 342, in execute
self.check()
File "/usr/local/lib/python2.7/site-
packages/django/core/management/base.py", line 374, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/site-
packages/django/core/management/commands/migrate.py", line 61, in
_run_checks
issues = run_checks(tags=[Tags.database])
File "/usr/local/lib/python2.7/site-
packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/site-
packages/django/core/checks/database.py", line 10, in
check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "/usr/local/lib/python2.7/site-
packages/django/db/backends/mysql/validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "/usr/local/lib/python2.7/site-
packages/django/db/backends/mysql/validation.py", line 16, in
_check_sql_mode
modes = set(sql_mode[0].split(','))
TypeError: 'NoneType' object has no attribute '__getitem__'
}}}
The reason is, that `SELECT @@sql_mode` returns no results in my special
case.
Just a little side note: `migrate` runs database checks against all
database connections, no matter if a database is selected via the
`--database` parameter or if migrations are not allowed because of a
database router. I'm not quite sure if this works as intended.
--
Ticket URL: <https://code.djangoproject.com/ticket/27180>
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/051.8492dc590a5f2e8fd99116168f1959b7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.