Skip to content
Open
Changes from all commits
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
7 changes: 7 additions & 0 deletions soda/trino/soda/data_sources/trino_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(self, logs: Logs, data_source_name: str, data_source_properties: di
self.username = data_source_properties.get("username")
self.authType = data_source_properties.get("auth_type", "BasicAuthentication")
self.password = data_source_properties.get("password")
self.access_token = data_source_properties.get("access_token")
self.source = data_source_properties.get("source", trino.constants.DEFAULT_SOURCE)
self.http_headers = data_source_properties.get("http_headers", None)
self.client_tags = data_source_properties.get("client_tags", None)
Expand All @@ -76,6 +77,12 @@ def connect(self):
# Default to BasicAuthentication so we don't break current users.
if self.authType == "BasicAuthentication":
self.auth = trino.auth.BasicAuthentication(self.username, self.password)
elif self.authType == "JWTAuthentication":
if not self.access_token or self.access_token == "":
logger.error("Trino JWT authentication requires an access token.")
self.connection = None
return
self.auth = trino.auth.JWTAuthentication(self.access_token)
elif self.authType == "NoAuthentication":
# No auth typically should use http. If your connection fails, try 'http_scheme: http' in your data source confguration.
self.auth = None
Expand Down