Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Username + Password Authentication for Trino Client (fixes #829) #1315

Merged
merged 3 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion querybook/server/lib/query_executor/clients/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(
self,
connection_string: str,
username: Optional[str] = None,
password: Optional[str] = None,
proxy_user: Optional[str] = None,
*args: Any,
**kwargs: Any,
Expand All @@ -61,12 +62,15 @@ def __init__(
host = trino_conf.host
port = 8080 if not trino_conf.port else trino_conf.port

auth = trino.auth.BasicAuthentication(username, password)
rbb17 marked this conversation as resolved.
Show resolved Hide resolved

connection = trino.dbapi.connect(
host=host,
port=port,
catalog=trino_conf.catalog,
schema=trino_conf.schema,
user=proxy_user or username,
auth=auth,
user=proxy_user if proxy_user else username,
http_scheme=trino_conf.protocol,
)
self._connection = connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
),
),
("username", FormField(regex="\\w+")),
("impersonate", FormField(field_type=FormFieldType.Boolean)),
("password", FormField(hidden=True)),
(
"proxy_user_id",
FormField(
Expand Down