[Django] #20542: pymysql breaks last_executed_query()

20 views
Skip to first unread message

Django

unread,
May 31, 2013, 5:12:00 PM5/31/13
to django-...@googlegroups.com
#20542: pymysql breaks last_executed_query()
----------------------------------------------+--------------------
Reporter: christian.oudard@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
In last_executed_query(), the value returned by cursor._last_executed is
unconditionally decoded as utf8. This presumes that it is a byte string
with utf8 encoding.

On the MySQLdb driver, this is true, but on pymysql, it returns a unicode
string instead. This prevents anyone from running queries containing
unicode characters in debug mode while using pymysql.

I can make a patch for this if necessary.

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

Django

unread,
May 31, 2013, 5:37:18 PM5/31/13
to django-...@googlegroups.com
#20542: pymysql breaks last_executed_query()
-------------------------------------+-------------------------------------

Reporter: christian.oudard@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.5
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by akaariai):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0


Comment:

Patches welcome.

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

Django

unread,
Nov 28, 2013, 7:00:04 PM11/28/13
to django-...@googlegroups.com
#20542: pymysql breaks last_executed_query()
-------------------------------------+-------------------------------------
Reporter: christian.oudard@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.5
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by russellm):

Is PyMySQL really a drop in replacement for MySQLdb? It looks to me like
the base package name is different, so I don't see how it is possible that
this works at all without either an import shim, or a completely different
database backend.

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

Django

unread,
Nov 29, 2013, 2:45:08 AM11/29/13
to django-...@googlegroups.com
#20542: pymysql breaks last_executed_query()
-------------------------------------+-------------------------------------
Reporter: christian.oudard@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.5
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by claudep):

I have a branch which more or less supports PyMySQL.
https://github.com/claudep/django/compare/pymysql

Quoting Alex (regarding the above branch):
''The right way to do this type of thing is to really split the adapter
part of a database backend away from the database part of it. So we can
easily have PyMySQL, MySQLdb, psycopg2, pg8000, py-postgresql, postgresql-
ctypes, and whatever else shows up, without needing to continually add to
the chain of `except ImportError`.''

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

Django

unread,
Aug 7, 2014, 12:00:22 PM8/7/14
to django-...@googlegroups.com
#20542: pymysql breaks last_executed_query()
-------------------------------------+-------------------------------------
Reporter: christian.oudard@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.5
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by CollinAnderson):

* cc: cmawebsite@… (added)


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

Django

unread,
Jan 27, 2015, 1:23:36 PM1/27/15
to django-...@googlegroups.com
#20542: pymysql breaks last_executed_query()
-------------------------------------+-------------------------------------
Reporter: christian.oudard@… | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.5
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by collinanderson):

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


Comment:

Closing now that mysqlclient is our official recommended connector.

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

Reply all
Reply to author
Forward
0 new messages