Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#22584 closed Uncategorized (invalid)

Tests always fail with the Django backend from MySQL Connector/Python

Reported by: Markus Amalthea Magnuson Owned by: nobody
Component: Uncategorized Version: 1.7-beta-2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I'm running a Django 1.7b3 project with a MySQL database using the Django backend from the MySQL Connector from Oracle, as advised in the Django docs if running Python 3.

With this setup, running test will always fail with this error:

    File "/Users/markus/.virtualenvs/clown/lib/python3.4/site-packages/mysql/connector/django/", line 50, in sql_table_creation_suffix
        if self.connection.settings_dict['TEST_CHARSET']:

This is due to the fact the the various TEST_ settings have finally been deprecated in Django 1.7, but the connector assumes these exist. The error is caused specifically by this method in connector/django/

def sql_table_creation_suffix(self):
    suffix = []
    if self.connection.settings_dict['TEST_CHARSET']:
        suffix.append('CHARACTER SET {0}'.format(
    if self.connection.settings_dict['TEST_COLLATION']:
        suffix.append('COLLATE {0}'.format(
    return ' '.join(suffix)

I'm not sure what the immediate solution is other than using Django's built-in MySQL backend. Why is this not the recommended way in the documentation? Does it not (yet) support Python 3?

Who knows when Oracle will fix this on their side, the problem persists in their latest dev release (1.2.1 rc) of the Python connector.

Change History (4)

comment:1 Changed 9 years ago by Markus Amalthea Magnuson

Summary: Test always fail with the Django backend from MySQL Connector/PythonTests always fail with the Django backend from MySQL Connector/Python

comment:2 Changed 9 years ago by Tim Graham

Resolution: invalid
Status: newclosed

Yes, the problem with the external backend is that there will always be a lag between Django releases and Oracle updating their backend to be compatible. It's not clear to me from their documentation what versions of Django the connector claims to support so you should probably file a bug with them on that. I don't think there's anything we can do with this ticket. It seems eventually we may remove the MySQL backend bundled with Django in favor of recommending the connector, see #12500.

comment:3 Changed 9 years ago by Markus Amalthea Magnuson

What problems would be solved by removing the bundled backend? It is using the connector from Oracle that causes this error, not the other way around.

comment:4 Changed 9 years ago by Tim Graham

It would be one less thing for the core team to maintain I suppose, and MySQLdb, which the bundled backend uses, does not support Python 3. There is lots of discussion in the linked ticket and related mailing list thread. Who knows what will eventually happen...

Note: See TracTickets for help on using tickets.
Back to Top