Skip to content

Commit

Permalink
Create driver_args dict only if either "user" or "password" has been …
Browse files Browse the repository at this point in the history
…given
  • Loading branch information
devops-42 committed Apr 7, 2024
1 parent 1f0ceb7 commit 0f5e04d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions redash/query_runner/jdbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ def run_query(self, query, user):
if self.configuration.get("properties"):
jdbc_url += "/?" + (self.configuration.get("properties"))

driver_args = {
"user": (self.configuration.get("user") or None),
"password": (self.configuration.get("password") or None),
}
if self.configuration.get("user") or self.configuration.get("password"):
driver_args = {
"user": (self.configuration.get("user") or None),
"password": (self.configuration.get("password") or None),
}
else:
driver_args = None

connection = jdbc.connect(jclassname=jdbc_class, url=jdbc_url, driver_args=driver_args, jars=jars)

Expand Down

0 comments on commit 0f5e04d

Please sign in to comment.