[Django] #30150: Django 1.11 with MySQL 8: "Unknown system variable 'TX_ISOLATION'"

26 views
Skip to first unread message

Django

unread,
Feb 1, 2019, 5:35:49 AM2/1/19
to django-...@googlegroups.com
#30150: Django 1.11 with MySQL 8: "Unknown system variable 'TX_ISOLATION'"
-------------------------------------+-------------------------------------
Reporter: Carsten | Owner: nobody
Fuchs |
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
https://docs.djangoproject.com/en/1.11/ref/databases/#version-support
suggests that Django 1.11 works with MySQL 8, but besides #29451, there is
a problem similar to #28804 and #28794:

{{{
#!sh
$ python manage.py check --deploy
Traceback (most recent call last):
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/django/db/backends/mysql/base.py", line 101, in execute
return self.cursor.execute(query, args)
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/MySQLdb/cursors.py", line 412, in _query
rowcount = self._do_query(q)
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/MySQLdb/cursors.py", line 375, in _do_query
db.query(q)
File "/home/carsten/.virtualenvs/Zeiterfassung/lib/python3.6/site-
packages/MySQLdb/connections.py", line 276, in query
_mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1193, "Unknown system variable
'TX_ISOLATION'")

The above exception was the direct cause of the following exception:

[...]
}}}

This can be worked-around by changing line 289 in
`db/backends/mysql/base.py`
{{{
assignments.append("TX_ISOLATION = '%s'" %
self.isolation_level)
}}}
into
{{{
assignments.append("transaction_isolation = '%s'" %
self.isolation_level)
}}}

Any chance to get this, with proper checks for the MySQL version, into
Django 1.11?

--
Ticket URL: <https://code.djangoproject.com/ticket/30150>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 1, 2019, 8:37:31 AM2/1/19
to django-...@googlegroups.com
#30150: Django 1.11 with MySQL 8: "Unknown system variable 'TX_ISOLATION'"
-------------------------------------+-------------------------------------
Reporter: Carsten Fuchs | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
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 Tim Graham <timograham@…>):

In [changeset:"951ee0b118eb640e6484189117be3308417d87bd" 951ee0b1]:
{{{
#!CommitTicketReference repository=""
revision="951ee0b118eb640e6484189117be3308417d87bd"
[1.11.x] Refs #30150 -- Doc'd that MySQL 8 isn't supported.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30150#comment:1>

Django

unread,
Feb 1, 2019, 8:38:24 AM2/1/19
to django-...@googlegroups.com
#30150: Django 1.11 with MySQL 8: "Unknown system variable 'TX_ISOLATION'"
-------------------------------------+-------------------------------------
Reporter: Carsten Fuchs | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 Tim Graham):

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


Comment:

Per the [https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions supported versions policy], 1.1.11.x only receives
data loss and security fixes.

--
Ticket URL: <https://code.djangoproject.com/ticket/30150#comment:2>

Django

unread,
Feb 1, 2019, 8:55:56 AM2/1/19
to django-...@googlegroups.com
#30150: Django 1.11 with MySQL 8: "Unknown system variable 'TX_ISOLATION'"
-------------------------------------+-------------------------------------
Reporter: Carsten Fuchs | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 Carsten Fuchs):

Well, it's probably only me, but this puts me into a somewhat precarious
situation:
Django 1.11 supports Oracle 11 and MySQL 5*, but not Oracle 12 or MySQL 8.
Django 2 supports Oracle 12 and MySQL 8, but not Oracle 11.

As I intend to switch from Oracle 11 to MySQL, the only supported upgrade
path that is left is:
Django 1.11 with Oracle 11 --> Django 1.11 with MySQL 5.7 --> Django 2.0
with MySQL 5.7 --> Django 2.0 with MySQL 8 --> Django 2.1 with MySQL 8.

I'll probably take the risk and use MySQL 8 right from the start anyways,
but I wished there had been a milder step possible.

--
Ticket URL: <https://code.djangoproject.com/ticket/30150#comment:3>

Django

unread,
Feb 3, 2019, 5:40:02 AM2/3/19
to django-...@googlegroups.com
#30150: Django 1.11 with MySQL 8: "Unknown system variable 'TX_ISOLATION'"
-------------------------------------+-------------------------------------
Reporter: Carsten Fuchs | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 Adam (Chainz) Johnson):

* cc: Adam (Chainz) Johnson (added)


Comment:

Carsten, you can always create a subclassed database backend in your
project to add the compatibility with MySQL 8 in Django 1.11. You might
find it's not just transaction_isolation that's the relevant change, maybe
there are more things to backport from 2.0 for that.

--
Ticket URL: <https://code.djangoproject.com/ticket/30150#comment:4>

Django

unread,
Feb 3, 2019, 9:03:32 AM2/3/19
to django-...@googlegroups.com
#30150: Django 1.11 with MySQL 8: "Unknown system variable 'TX_ISOLATION'"
-------------------------------------+-------------------------------------
Reporter: Carsten Fuchs | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 Carsten Fuchs):

Replying to [comment:4 Adam (Chainz) Johnson]:


> Carsten, you can always create a subclassed database backend in your
project to add the compatibility with MySQL 8 in Django 1.11. You might
find it's not just transaction_isolation that's the relevant change, maybe
there are more things to backport from 2.0 for that.

Yes, there are certainly a lot more considerations involved with using
MySQL 8 with Django 1.11, e.g. #18392 and #29451.
Fortunately, during the tests and research that I spent during the last
weeks, I have not become aware of any other issues that indicate anything
but a reliable running of MySQL 8 with Django 1.11.
Given Django 1.11's status as noted by Tim above and given that I intend
to upgrade to Django 2.0+ as soon as I got confident that my transition
from Oracle to MySQL went well, there is no point in adding features to
1.11 that won't make it into an official release. (And unfortunately, I
don't think that I understand enough of the Django source code to address
issues at that level, at least at the scale of a database backend.)

--
Ticket URL: <https://code.djangoproject.com/ticket/30150#comment:5>

Reply all
Reply to author
Forward
0 new messages