Opened 7 years ago
Last modified 4 years ago
#12821 closed enhancement
Add support for pymysql library — at Version 8
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.3.2 |
Component: | database backend | Version: | |
Severity: | normal | Keywords: | mysql |
Cc: | Branch: | ||
Release Notes: |
PyMySQL is the supported MySQL library, dropping support for MySQLdb-python. |
||
API Changes: | |||
Internal Changes: |
Change History (8)
comment:1 by , 7 years ago
Release Notes: | modified (diff) |
---|
follow-up: 7 comment:2 by , 7 years ago
I omitted something important. Tests pass with the following change:
-
setup.py
diff --git a/setup.py b/setup.py index 633a4d3b3..cd6fa235f 100755
a b facilities. 95 95 extras_require = { 96 96 'genshi': ['Genshi>=0.6'], 97 97 'babel': ['Babel>=0.9.5'], 98 'mysql': [' MySQL-python >= 1.2.2'],98 'mysql': ['PyMySQL'], 99 99 'postgresql': ['psycopg2 >= 2.0'], 100 100 'pygments': ['Pygments>=1.0'], 101 101 'rest': ['docutils>=0.3.9'],
I haven't looked closely if or how we can specify "MySQL-python or PyMySQL" for the installation requirement in setup.py
.
Also, looks like signature of _show_warnings
changed in PyMySQL 0.7.6, and latest package has a strange version string:
>>> import pymysql as MySQLdb >>> MySQLdb.__version__ '0.7.11.None'
Additional changes in [42f422aeb/rjollos.git].
comment:3 by , 7 years ago
how we can specify "MySQL-python or PyMySQL" for the installation requirement in
setup.py
.
According to this (and this) it seems something like this would be needed:
-
setup.py
diff -r 22cef9e62a11 setup.py
a b 41 41 print("Jinja2 is needed by Trac setup, pre-installing") 42 42 # give some context to the warnings we might get when installing Jinja2 43 43 44 try: 45 import pymysql 46 mysql = 'PyMySQL' 47 except ImportError: 48 mysql = 'MySQL-python >= 1.2.2' 49 44 50 45 51 setup( 46 52 name = 'Trac', … … 95 101 extras_require = { 96 102 'genshi': ['Genshi>=0.6'], 97 103 'babel': ['Babel>=0.9.5'], 98 'mysql': [ 'MySQL-python >= 1.2.2'],104 'mysql': [mysql], 99 105 'postgresql': ['psycopg2 >= 2.0'], 100 106 'pygments': ['Pygments>=1.0'], 101 107 'rest': ['docutils>=0.3.9'],
comment:4 by , 7 years ago
It might be good to support mysql+mysqldb://...
for MySQL-python and mysql+pymysql://...
for PyMySQL, like SQLAlchemy.
Another consideration, how about switching to PyMySQL from MySQL-python? The original MySQL-python doesn't support Python 3 but https://github.com/PyMySQL/mysqlclient-python supports Python 3. No new commits since 2014 on https://github.com/farcepest/MySQLdb1.
comment:5 by , 7 years ago
I like the idea of supporting just one MySQL library.
I started to update the compatible distros matrix. pymysql
is available on Ubuntu 16.04. I don't see it in Debian 8.8, and looks like it may still be in unstable. Does anyone think that matters since a user can just pip install
it?
comment:6 by , 7 years ago
Proposed additional changes in [4f56ad5b2/jomae.git]. I'd like to add charset
parameter to database connection string for MySQL, to avoid reconnecting when database charset is not matched with client charset.
Yeah, no matters. Even Trac 1.2 on Debian is still sid.
comment:7 by , 7 years ago
Replying to Ryan J Ollos:
Also, looks like signature of
_show_warnings
changed in PyMySQL 0.7.6, and latest package has a strange version string:
Created a pull request for the issue.
comment:8 by , 7 years ago
Release Notes: | modified (diff) |
---|
Latest changes, including comment:6 changes, in log:rjollos.git:t12821_pymysql.1.
Tests pass on OSX with the following versions of pymysql:
- 0.7.11
- 0.6.7
- 0.6
- DONE Update 1.3/TracInstall (1.3/TracInstall@7)
- DONE Update 1.3/TracUpgrade (1.3/TracUpgrade@15)
Proposed changes in [4bacb9a74/rjollos.git].
DONE Add Travis CI and AppVeyor build configurations that use pymysql.