I have just built a patched version of python-django which changes the
check for python3-mysqldb >= 1.3.13 so that it runs on the existing
1.3.10 stable version.

It seems to work fine. We have a fairly complicated database schema in
our django app, but we are not doing anything very 'fancy' (like
transaction rollbacks). Despite much reading of issues, bug reports
and commits, I have not been able to work out exactly _why_ the
required version was upped and whether anything important changed. (I
found good info for PyMySQL in this regard, but not the mysqldb
module).

I also found that it is trivial to build python-mysqldb 1.4.4 so a
backport of that would be very straightforward. But as this point in the
release cycle I'm not sure therre is any point actually uploading such
a thing? A new upload of python-django with the mysqldb version
constraint relaxed so that it actually installs would make sense.

Running C_ALL=C.UTF-8 PYTHONPATH=.. python3 ./runtests.py --verbosity 2 
--settings test_mysql backends/mysql/
runs the mysql tests with no errors.

Testing against Django installed in '/usr/lib/python3/dist-packages/django' 
with up to 2 processes
Creating test database for alias 'default' ('test_testing')...
Operations to perform:
  Synchronize unmigrated apps: auth, contenttypes, messages, sessions, 
staticfiles
  Apply all migrations: admin, sites
Synchronizing apps without migrations:
  Creating tables...
    Creating table django_content_type
    Creating table auth_permission
    Creating table auth_group
    Creating table auth_user
    Creating table django_session
    Running deferred SQL...
Running migrations:
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying sites.0001_initial... OK
  Applying sites.0002_alter_domain_unique... OK
Cloning test database for alias 'default' ('test_testing')...
Cloning test database for alias 'default' ('test_testing')...
System check identified no issues (0 silenced).
test_skip_locked_no_wait (backends.mysql.test_features.TestFeatures) ... ok
test_supports_transactions (backends.mysql.test_features.TestFeatures) ... ok
test_quote_value (backends.mysql.test_schema.SchemaEditorTests) ... ok
test_clone_test_db_database_exists 
(backends.mysql.test_creation.DatabaseCreationTests) ... ok
test_create_test_db_database_exists 
(backends.mysql.test_creation.DatabaseCreationTests) ... ok
test_create_test_db_unexpected_error 
(backends.mysql.test_creation.DatabaseCreationTests) ... ok
test_auto_is_null_auto_config (backends.mysql.tests.IsolationLevelTests) ... ok
test_connect_isolation_level (backends.mysql.tests.IsolationLevelTests) ... ok
test_default_isolation_level (backends.mysql.tests.IsolationLevelTests) ... ok
test_isolation_level_validation (backends.mysql.tests.IsolationLevelTests) ... 
ok
test_setting_isolation_level (backends.mysql.tests.IsolationLevelTests) ... ok
test_uppercase_isolation_level (backends.mysql.tests.IsolationLevelTests) ... ok

----------------------------------------------------------------------
Ran 12 tests in 0.425s

OK
Destroying test database for alias 'default' ('test_testing_1')...
Destroying test database for alias 'default' ('test_testing_2')...
Destroying test database for alias 'default' ('test_testing')...


The full testsuite did barf on a couple of things, but I don't think they
are anything to do with mysqldb:
admin_inlines.tests (unittest.loader._FailedTest) failed:
test_annotated_ordering (queries.tests.QuerysetOrderedTests) failed:

Overall I think we are good with 1.3.10.

Debdiff Patch attached

Wookey
--
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/
diff -Nru python-django-2.2.19/debian/changelog python-django-2.2.19/debian/changelog
--- python-django-2.2.19/debian/changelog	2021-02-22 10:10:28.000000000 +0000
+++ python-django-2.2.19/debian/changelog	2021-04-09 00:45:49.000000000 +0100
@@ -1,3 +1,10 @@
+python-django (2:2.2.19-1~bpo10+1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Relax checks to work with python3-myqsldb 1.3.10 in stable
+
+ -- Wookey <[email protected]>  Fri, 09 Apr 2021 00:45:49 +0100
+
 python-django (2:2.2.19-1~bpo10+1) buster-backports; urgency=medium
 
   * Rebuild for buster-backports.
diff -Nru python-django-2.2.19/debian/control python-django-2.2.19/debian/control
--- python-django-2.2.19/debian/control	2021-02-22 10:10:28.000000000 +0000
+++ python-django-2.2.19/debian/control	2021-04-08 21:31:03.000000000 +0100
@@ -49,7 +49,7 @@
 Breaks:
  python-django-common,
  python3-django-filters (<< 2.1.0),
- python3-mysqldb (<< 1.3.13),
+ python3-mysqldb (<< 1.3.10),
 Depends:
  ${misc:Depends},
  ${python3:Depends},
diff -Nru python-django-2.2.19/debian/patches/0006-use-stable-version-of-myqsldb.patch python-django-2.2.19/debian/patches/0006-use-stable-version-of-myqsldb.patch
--- python-django-2.2.19/debian/patches/0006-use-stable-version-of-myqsldb.patch	1970-01-01 01:00:00.000000000 +0100
+++ python-django-2.2.19/debian/patches/0006-use-stable-version-of-myqsldb.patch	2021-04-09 00:45:27.000000000 +0100
@@ -0,0 +1,15 @@
+Index: python-django-2.2.19/django/db/backends/mysql/base.py
+===================================================================
+--- python-django-2.2.19.orig/django/db/backends/mysql/base.py
++++ python-django-2.2.19/django/db/backends/mysql/base.py
+@@ -32,8 +32,8 @@ from .schema import DatabaseSchemaEditor
+ from .validation import DatabaseValidation                  # isort:skip
+ 
+ version = Database.version_info
+-if version < (1, 3, 13):
+-    raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
++if version < (1, 3, 10):
++    raise ImproperlyConfigured('mysqlclient 1.3.10 or newer is required; you have %s.' % Database.__version__)
+ 
+ 
+ # MySQLdb returns TIME columns as timedelta -- they are more like timedelta in
diff -Nru python-django-2.2.19/debian/patches/series python-django-2.2.19/debian/patches/series
--- python-django-2.2.19/debian/patches/series	2021-02-22 10:10:28.000000000 +0000
+++ python-django-2.2.19/debian/patches/series	2021-04-09 00:44:18.000000000 +0100
@@ -3,3 +3,4 @@
 0004-Use-locally-installed-documentation-sources.patch
 0004-Set-the-default-shebang-to-new-projects-to-use-Pytho.patch
 0005-Use-usr-bin-env-python3-shebang-for-django-admin.py.patch
+0006-use-stable-version-of-myqsldb.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to