id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 27180,Check for sql_mode fails during migration with special database connections,Markus Gerards,nobody,"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 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.",Bug,closed,"Database layer (models, ORM)",1.10,Release blocker,fixed,,,Accepted,0,0,0,0,0,0