mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 17:15:17 +00:00
Fix: there is no host field. (#4873)
Co-authored-by: Arik Fraimovich <arik@arikfr.com> Co-authored-by: Arik Fraimovich <arik@arikfr.com>
This commit is contained in:
parent
6d857588a1
commit
57287b2c0b
@ -35,19 +35,24 @@ class SQLServerODBC(BaseSQLQueryRunner):
|
||||
"default": "UTF-8",
|
||||
"title": "Character Set",
|
||||
},
|
||||
"use_ssl": {
|
||||
"type": "boolean",
|
||||
"title": "Use SSL",
|
||||
"default": False,
|
||||
},
|
||||
"use_ssl": {"type": "boolean", "title": "Use SSL", "default": False,},
|
||||
"verify_ssl": {
|
||||
"type": "boolean",
|
||||
"title": "Verify SSL certificate",
|
||||
"default": True,
|
||||
},
|
||||
},
|
||||
"order": ["server", "port", "user", "password", "db", "charset", "use_ssl", "verify_ssl"],
|
||||
"required": ["host", "user", "password", "db"],
|
||||
"order": [
|
||||
"server",
|
||||
"port",
|
||||
"user",
|
||||
"password",
|
||||
"db",
|
||||
"charset",
|
||||
"use_ssl",
|
||||
"verify_ssl",
|
||||
],
|
||||
"required": ["server", "user", "password", "db"],
|
||||
"secret": ["password"],
|
||||
"extra_options": ["verify_ssl", "use_ssl"],
|
||||
}
|
||||
@ -105,17 +110,15 @@ class SQLServerODBC(BaseSQLQueryRunner):
|
||||
port = self.configuration.get("port", 1433)
|
||||
charset = self.configuration.get("charset", "UTF-8")
|
||||
|
||||
connection_string_fmt = (
|
||||
"DRIVER={{ODBC Driver 17 for SQL Server}};PORT={};SERVER={};DATABASE={};UID={};PWD={}"
|
||||
)
|
||||
connection_string_fmt = "DRIVER={{ODBC Driver 17 for SQL Server}};PORT={};SERVER={};DATABASE={};UID={};PWD={}"
|
||||
connection_string = connection_string_fmt.format(
|
||||
port, server, db, user, password
|
||||
)
|
||||
|
||||
if self.configuration.get('use_ssl', False):
|
||||
if self.configuration.get("use_ssl", False):
|
||||
connection_string += ";Encrypt=YES"
|
||||
|
||||
if not self.configuration.get('verify_ssl'):
|
||||
if not self.configuration.get("verify_ssl"):
|
||||
connection_string += ";TrustServerCertificate=YES"
|
||||
|
||||
connection = pyodbc.connect(connection_string)
|
||||
|
Loading…
Reference in New Issue
Block a user