Skip to content

Commit

Permalink
Add user/pass authentication support for Druid (#4315)
Browse files Browse the repository at this point in the history
* Add support for configuring a Username/Password for the connection to Druid

* Bump pydruid version for username/password support

* Deal with missing/empty configuration parameters
  • Loading branch information
Jakdaw authored and arikfr committed Dec 5, 2019
1 parent 15e8b88 commit 3494e21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions redash/query_runner/druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@ def configuration_schema(cls):
"scheme": {
"type": "string",
"default": "http"
},
"user": {
"type": "string"
},
"password": {
"type": "string"
}
},
"order": ['scheme', 'host', 'port'],
"required": ['host']
"order": ['scheme', 'host', 'port', 'user', 'password'],
"required": ['host'],
"secret": ['password']
}

@classmethod
Expand All @@ -48,7 +55,9 @@ def run_query(self, query, user):
connection = connect(host=self.configuration['host'],
port=self.configuration['port'],
path='/druid/v2/sql/',
scheme=self.configuration['scheme'])
scheme=(self.configuration.get('scheme') or 'http'),
user=(self.configuration.get('user') or None),
password=(self.configuration.get('password') or None))

cursor = connection.cursor()

Expand Down
2 changes: 1 addition & 1 deletion requirements_all_ds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PyAthena>=1.5.0
pymapd==0.16.0
qds-sdk>=1.9.6
ibm-db>=2.0.9
pydruid==0.5.5
pydruid==0.5.7
requests_aws_sign==0.1.5
snowflake-connector-python==2.0.3
phoenixdb==0.7
Expand Down

0 comments on commit 3494e21

Please sign in to comment.