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 authored and jezdez committed Mar 25, 2019
1 parent e79b5ea commit c55edf5
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 @@ -90,7 +90,7 @@ def name(cls):
@classmethod
def enabled(cls):
try:
import MySQLdb
import pymysql
except ImportError:
return False

Expand Down Expand Up @@ -126,11 +126,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 @@ -160,7 +160,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 @@ -2,7 +2,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.5.1
pymongo[tls,srv]==3.6.1
Expand Down

0 comments on commit c55edf5

Please sign in to comment.