Skip to content

Commit

Permalink
Merge pull request #406 from stanhu/add-mysql-port
Browse files Browse the repository at this point in the history
Add support for configuring MySQL port
  • Loading branch information
arikfr committed Apr 18, 2015
2 parents 73de936 + 498e1d4 commit 8a35dce
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions redash/query_runner/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def configuration_schema(cls):
'db': {
'type': 'string',
'title': 'Database name'
}
},
"port": {
"type": "number"
},
},
'required': ['db']
}
Expand Down Expand Up @@ -82,10 +85,11 @@ def get_schema(self):
def run_query(self, query):
import MySQLdb

connection = MySQLdb.connect(self.configuration.get('host', ''),
self.configuration.get('user', ''),
self.configuration.get('passwd', ''),
self.configuration['db'],
connection = MySQLdb.connect(host=self.configuration.get('host', ''),
user=self.configuration.get('user', ''),
passwd=self.configuration.get('passwd', ''),
db=self.configuration['db'],
port=self.configuration.get('port', 3306),
charset='utf8', use_unicode=True)
cursor = connection.cursor()

Expand Down Expand Up @@ -129,4 +133,4 @@ def run_query(self, query):

return json_data, error

register(Mysql)
register(Mysql)

0 comments on commit 8a35dce

Please sign in to comment.