Skip to content

Fix parameter changes in MySQLdb v2.1 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions memsql/common/database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""A lightweight wrapper around _mysql."""

from MySQLdb import _mysql
import MySQLdb
import time
import operator

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

# Fix for parameter name changes in mysqlclient v2.1.0
if MySQLdb.version_info[:2] >= (2, 1):
if "db" in args:
args["database"] = args.pop("db")
if "passwd" in args:
args["password"] = args.pop("passwd")

self._db = None
self._db_args = args

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
'wraptor',
'simplejson',
'python-dateutil<3.0',
'mysqlclient<2.0',
'mysqlclient>=1.4',
]

class PyTest(TestCommand):