From b0c33a08cb61e871501666c07139e61d80b39005 Mon Sep 17 00:00:00 2001 From: Allen Short Date: Thu, 14 Sep 2017 06:23:44 +0000 Subject: [PATCH] Switch to PyMySQL for MySQL 5.7 support --- redash/query_runner/mysql.py | 8 ++++---- requirements_all_ds.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/redash/query_runner/mysql.py b/redash/query_runner/mysql.py index fafa5edf16..3679b694db 100644 --- a/redash/query_runner/mysql.py +++ b/redash/query_runner/mysql.py @@ -91,7 +91,7 @@ def name(cls): @classmethod def enabled(cls): try: - import MySQLdb + import pymysql except ImportError: return False @@ -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'], @@ -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: diff --git a/requirements_all_ds.txt b/requirements_all_ds.txt index 8a0dd106a8..4f38ee9335 100644 --- a/requirements_all_ds.txt +++ b/requirements_all_ds.txt @@ -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