Skip to content

Commit

Permalink
Switch to PyMySQL for MySQL 5.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short committed Jan 8, 2018
1 parent eb484dd commit a391284
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions redash/query_runner/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def name(cls):
@classmethod
def enabled(cls):
try:
import MySQLdb
import pymysql
except ImportError:
return False

Expand Down Expand Up @@ -127,11 +127,11 @@ def _get_tables(self, schema):
return schema.values()

def run_query(self, query, user):
import MySQLdb
import pymysql

connection = None
try:
connection = MySQLdb.connect(host=self.configuration.get('host', ''),
connection = pymysql.connect(host=self.configuration.get('host', ''),
user=self.configuration.get('user', ''),
passwd=self.configuration.get('passwd', ''),
db=self.configuration['db'],
Expand Down Expand Up @@ -161,7 +161,7 @@ def run_query(self, query, user):
error = "No data was returned."

cursor.close()
except MySQLdb.Error as e:
except pymysql.Error as e:
json_data = None
error = e.args[1]
except KeyboardInterrupt:
Expand Down
2 changes: 1 addition & 1 deletion requirements_all_ds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ google-api-python-client==1.5.1
gspread==0.6.2
impyla==0.10.0
influxdb==2.7.1
MySQL-python==1.2.5
PyMySQL==0.7.11
oauth2client==3.0.0
pyhive==0.3.0
pymongo==3.2.1
Expand Down

0 comments on commit a391284

Please sign in to comment.