Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3747 closed (fixed)

Changeset [4724] MySQLdb versioncheck not working.

Reported by: derelm Owned by: adrian
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


# django/db/backends/mysql/
import MySQLdb as Database
if Database.version_info < (1,2,1,'final',2):
	    raise ImportError, "MySQLdb-1.2.1p2 or newer is required; you have %s" % MySQLdb.__version__

Debian Sarge comes with MySQLdb 1.2.1.g2 but the check effectively doesn't kick in.

>>> (1,2,1,'gamma',2) < (1,2,1,'final',2)

Also MySQLdb has been imported as Database so the Error raised needs to be

raise ImportError, "MySQLdb-1.2.1p2 or newer is required; you have %s" % Database.__version__

Change History (9)

comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Changeset [4724] MySQLdb versioncheck not working to Changeset [4724] MySQLdb versioncheck not working.
  • Triage Stage changed from Unreviewed to Accepted

Design Decision needed re: version support (we should prob. support a well-established os like sarge, but what are the differences between MySQLdb gamma and final)?

The import error is ready to be checked in.

comment:2 Changed 9 years ago by Simon G. <dev@…>

I've looked around sourceforge for MySQLdb, but can't see any obvious way of finding the differences between 1.2.1 gamma and 1.2.1 final. I doubt, however, that there's any massive changes between a gamma release and a final release.

comment:3 Changed 9 years ago by derelm

With gamma i could not specify DATABASE_OPTIONS = dict(charset="utf8") - that would raise an error. (suggested to fix my problems in #2635). So there seem to be enough differences to cause problems with Django.

comment:4 Changed 9 years ago by mtredinnick

The problem that original forced us to recommend the upgrade to 1.2.1p2 or later (#3279) was only fixed in that precise version. So no earlier versions are recommended for production (and hence any) use with Django. I'm about to check in a version check that knows the difference between "gamma" and "final, 1" and "final, 2".

comment:5 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [4751]) Fixed #3747 -- Added a stricter MySQLdb version check so that (1, 2, 1,
'final', 2) passes and (1, 2, 1, 'gamma') does not. Also fixed a problem in the
error reporting when the check fails.

comment:6 Changed 9 years ago by anonymous

FWIW, this change broke my sites that are hosted on Dreamhost, as they have MySQL 1.2.1g3. Not suggesting it should be undone, just noting it, as I suspect there will be a lot of people wondering what happened.

comment:7 Changed 9 years ago by jeff@…

Sorry, I didn't mean to post that as anonymous. That was from me, Jeff Croft.

comment:8 Changed 9 years ago by mtredinnick

Jeff: that's the problem (not Dreamhost in particular, but the breakage in general) and why we had a bit of a discussion about this on django-dev. We're going to somewhat damned whichever way we go, unfortunately. :-(

comment:9 Changed 9 years ago by anonymous

Fair enough. Sorry I missed the discussion on django-dev. No big problem for me, just had to rollback that one file on Dreamhost. :)

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