Skip to content
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
Next Next commit
do changes with signing
Signed-off-by: ammarar <ammar.alrashed@gmail.com>
  • Loading branch information
ammarar committed Sep 24, 2022
commit 3293c85e83084333c26e68c935d80b6d2b9394ba
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ def __init__(
catalog: Optional[str] = None,
auth: Optional[Any] = None,
http_scheme: Optional[str] = None,
source: Optional[str] = None,
extra_credential: Optional[str] = None,
):
self.host = host or os.getenv("TRINO_HOST")
self.port = port or os.getenv("TRINO_PORT")
self.user = user or os.getenv("TRINO_USER")
self.catalog = catalog or os.getenv("TRINO_CATALOG")
self.auth = auth or os.getenv("TRINO_AUTH")
self.http_scheme = http_scheme or os.getenv("TRINO_HTTP_SCHEME")
self.source = source or os.getenv("TRINO_SOURCE")
self.extra_credential = extra_credential or os.getenv("TRINO_EXTRA_CREDENTIAL")
self._cursor: Optional[Cursor] = None

if self.host is None:
Expand All @@ -56,13 +60,16 @@ def __init__(

def _get_cursor(self) -> Cursor:
if self._cursor is None:
headers = {trino.constants.HEADER_EXTRA_CREDENTIAL: self.extra_credential} if self.extra_credential else {}
self._cursor = trino.dbapi.connect(
host=self.host,
port=self.port,
user=self.user,
catalog=self.catalog,
auth=self.auth,
http_scheme=self.http_scheme,
source=self.source,
http_headers=headers,
).cursor()

return self._cursor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def get_table_column_names_and_types(
self, config: RepoConfig
) -> Iterable[Tuple[str, str]]:
client = Trino(
user="user",
catalog=config.offline_store.catalog,
host=config.offline_store.host,
port=config.offline_store.port,
Expand Down