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': {
|
'db': {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'title': 'Database name'
|
'title': 'Database name'
|
||||||
}
|
},
|
||||||
|
"port": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'required': ['db']
|
'required': ['db']
|
||||||
}
|
}
|
||||||
@ -82,10 +85,11 @@ class Mysql(BaseQueryRunner):
|
|||||||
def run_query(self, query):
|
def run_query(self, query):
|
||||||
import MySQLdb
|
import MySQLdb
|
||||||
|
|
||||||
connection = MySQLdb.connect(self.configuration.get('host', ''),
|
connection = MySQLdb.connect(host=self.configuration.get('host', ''),
|
||||||
self.configuration.get('user', ''),
|
user=self.configuration.get('user', ''),
|
||||||
self.configuration.get('passwd', ''),
|
passwd=self.configuration.get('passwd', ''),
|
||||||
self.configuration['db'],
|
db=self.configuration['db'],
|
||||||
|
port=self.configuration.get('port', 3306),
|
||||||
charset='utf8', use_unicode=True)
|
charset='utf8', use_unicode=True)
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user