Skip to content

Commit 2734600

Browse files
authored
Fix parameter changes in MySQLdb v2.1 (#23)
1 parent ba25ff9 commit 2734600

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

memsql/common/database.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""A lightweight wrapper around _mysql."""
22

33
from MySQLdb import _mysql
4+
import MySQLdb
45
import time
56
import operator
67

@@ -55,6 +56,13 @@ def __init__(self, host, port=3306, database="information_schema", user=None, pa
5556
assert isinstance(options, dict), "Options to database.Connection must be an dictionary of { str: value } pairs."
5657
args.update(options)
5758

59+
# Fix for parameter name changes in mysqlclient v2.1.0
60+
if MySQLdb.version_info[:2] >= (2, 1):
61+
if "db" in args:
62+
args["database"] = args.pop("db")
63+
if "passwd" in args:
64+
args["password"] = args.pop("passwd")
65+
5866
self._db = None
5967
self._db_args = args
6068

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
'wraptor',
1717
'simplejson',
1818
'python-dateutil<3.0',
19-
'mysqlclient<2.0',
19+
'mysqlclient>=1.4',
2020
]
2121

2222
class PyTest(TestCommand):

0 commit comments

Comments
 (0)