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