mirror of
https://github.com/valitydev/redash.git
synced 2024-11-08 01:48:54 +00:00
Merge pull request #406 from stanhu/add-mysql-port
Add support for configuring MySQL port
This commit is contained in:
commit
8a35dcedfa
@ -27,7 +27,10 @@ class Mysql(BaseQueryRunner):
|
||||
'db': {
|
||||
'type': 'string',
|
||||
'title': 'Database name'
|
||||
}
|
||||
},
|
||||
"port": {
|
||||
"type": "number"
|
||||
},
|
||||
},
|
||||
'required': ['db']
|
||||
}
|
||||
@ -82,10 +85,11 @@ class Mysql(BaseQueryRunner):
|
||||
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()
|
||||
|
||||
@ -129,4 +133,4 @@ class Mysql(BaseQueryRunner):
|
||||
|
||||
return json_data, error
|
||||
|
||||
register(Mysql)
|
||||
register(Mysql)
|
||||
|
Loading…
Reference in New Issue
Block a user