mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 17:38:54 +00:00
Add charset to configuration.
This commit is contained in:
parent
eaf127da71
commit
679e44c874
@ -54,6 +54,11 @@ class SqlServer(BaseSQLQueryRunner):
|
||||
"default": "7.0",
|
||||
"title": "TDS Version"
|
||||
},
|
||||
"charset": {
|
||||
"type": "string",
|
||||
"default": "UTF-8",
|
||||
"title": "Character Set"
|
||||
},
|
||||
"db": {
|
||||
"type": "string",
|
||||
"title": "Database Name"
|
||||
@ -120,15 +125,15 @@ class SqlServer(BaseSQLQueryRunner):
|
||||
db = self.configuration['db']
|
||||
port = self.configuration.get('port', 1433)
|
||||
tds_version = self.configuration.get('tds_version', '7.0')
|
||||
charset = self.configuration.get('charset', 'UTF-8')
|
||||
|
||||
if port != 1433:
|
||||
server = server + ':' + str(port)
|
||||
|
||||
connection = pymssql.connect(server=server, user=user, password=password, database=db, tds_version=tds_version)
|
||||
connection = pymssql.connect(server=server, user=user, password=password, database=db, tds_version=tds_version, charset=charset)
|
||||
|
||||
if isinstance(query, unicode):
|
||||
encoding = connection._conn.charset
|
||||
query = query.encode(encoding)
|
||||
query = query.encode(charset)
|
||||
|
||||
cursor = connection.cursor()
|
||||
logger.debug("SqlServer running query: %s", query)
|
||||
|
Loading…
Reference in New Issue
Block a user