[Django] #22584: Test always fail with the Django backend from MySQL Connector/Python

9 views
Skip to first unread message

Django

unread,
May 6, 2014, 8:37:04 AM5/6/14
to django-...@googlegroups.com
#22584: Test always fail with the Django backend from MySQL Connector/Python
---------------------------------+------------------------
Reporter: giuliettamasina | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------
I'm running a Django 1.7b3 project with a MySQL database using the Django
backend from the [http://dev.mysql.com/doc/connector-python/en/connector-
python-django-backend.html MySQL Connector] from Oracle, as advised in the
[https://docs.djangoproject.com/en/1.7/ref/databases/#mysql-db-api-drivers
Django docs if running Python 3].

With this setup, running `manage.py test` will always fail with this
error:

{{{
<snip>
File "/Users/markus/.virtualenvs/clown/lib/python3.4/site-
packages/mysql/connector/django/creation.py", line 50, in
sql_table_creation_suffix
if self.connection.settings_dict['TEST_CHARSET']:
KeyError: 'TEST_CHARSET'
}}}

This is due to the fact the the various `TEST_` settings have finally been
[https://docs.djangoproject.com/en/1.7/ref/settings/#test-charset
deprecated in Django 1.7], but the connector assumes these exist. The
error is caused specifically by this method in
`connector/django/creation.py`:

{{{
def sql_table_creation_suffix(self):
suffix = []
if self.connection.settings_dict['TEST_CHARSET']:
suffix.append('CHARACTER SET {0}'.format(
self.connection.settings_dict['TEST_CHARSET']))
if self.connection.settings_dict['TEST_COLLATION']:
suffix.append('COLLATE {0}'.format(
self.connection.settings_dict['TEST_COLLATION']))
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 [http://dev.mysql.com/downloads/connector/python/1.2.html latest dev
release (1.2.1 rc)] of the Python connector.

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

Django

unread,
May 6, 2014, 8:37:50 AM5/6/14
to django-...@googlegroups.com
#22584: Tests always fail with the Django backend from MySQL Connector/Python
---------------------------------+--------------------------------------

Reporter: giuliettamasina | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-beta-2
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
---------------------------------+--------------------------------------
Changes (by giuliettamasina):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
May 6, 2014, 8:52:23 AM5/6/14
to django-...@googlegroups.com
#22584: Tests always fail with the Django backend from MySQL Connector/Python
---------------------------------+--------------------------------------
Reporter: giuliettamasina | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Resolution: invalid
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 timo):

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


Comment:

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.

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

Django

unread,
May 6, 2014, 9:02:37 AM5/6/14
to django-...@googlegroups.com
#22584: Tests always fail with the Django backend from MySQL Connector/Python
---------------------------------+--------------------------------------
Reporter: giuliettamasina | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Resolution: invalid
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 giuliettamasina):

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.

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

Django

unread,
May 6, 2014, 9:11:27 AM5/6/14
to django-...@googlegroups.com
#22584: Tests always fail with the Django backend from MySQL Connector/Python
---------------------------------+--------------------------------------
Reporter: giuliettamasina | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Resolution: invalid
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 timo):

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...

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

Reply all
Reply to author
Forward
0 new messages