Merge pull request #406 from stanhu/add-mysql-port

Add support for configuring MySQL port
This commit is contained in:
Arik Fraimovich 2015-04-18 16:14:26 +03:00
commit 8a35dcedfa

View File

@ -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)