Skip to content

Commit

Permalink
Clickhouse: control whether to verify SSL certificate (#4631)
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish committed Feb 9, 2020
1 parent 80cfa3c commit e97510b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion redash/query_runner/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ def configuration_schema(cls):
"title": "Request Timeout",
"default": 30,
},
"verify": {
"type": "boolean",
"title": "Verify SSL certificate",
"default": True,
},
},
"order": ["url", "user", "password", "dbname"],
"required": ["dbname"],
"extra_options": ["timeout"],
"extra_options": ["timeout", "verify"],
"secret": ["password"],
}

Expand Down Expand Up @@ -59,6 +65,7 @@ def _get_tables(self, schema):
def _send_query(self, data, stream=False):
url = self.configuration.get("url", "http://127.0.0.1:8123")
try:
verify = self.configuration.get("verify", True)
r = requests.post(
url,
data=data.encode("utf-8"),
Expand All @@ -69,6 +76,7 @@ def _send_query(self, data, stream=False):
"password": self.configuration.get("password", ""),
"database": self.configuration["dbname"],
},
verify=verify,
)
if r.status_code != 200:
raise Exception(r.text)
Expand Down

0 comments on commit e97510b

Please sign in to comment.