Skip to content

Commit f38506c

Browse files
ammararadchia
authored andcommitted
fix: Add X-Trino-Extra-Credential header and remove user override (#3246)
* do changes with signing Signed-off-by: ammarar <[email protected]> * lint fix Signed-off-by: ammarar <[email protected]> Signed-off-by: ammarar <[email protected]>
1 parent f242e24 commit f38506c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

sdk/python/feast/infra/offline_stores/contrib/trino_offline_store/trino_queries.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ def __init__(
3636
catalog: Optional[str] = None,
3737
auth: Optional[Any] = None,
3838
http_scheme: Optional[str] = None,
39+
source: Optional[str] = None,
40+
extra_credential: Optional[str] = None,
3941
):
4042
self.host = host or os.getenv("TRINO_HOST")
4143
self.port = port or os.getenv("TRINO_PORT")
4244
self.user = user or os.getenv("TRINO_USER")
4345
self.catalog = catalog or os.getenv("TRINO_CATALOG")
4446
self.auth = auth or os.getenv("TRINO_AUTH")
4547
self.http_scheme = http_scheme or os.getenv("TRINO_HTTP_SCHEME")
48+
self.source = source or os.getenv("TRINO_SOURCE")
49+
self.extra_credential = extra_credential or os.getenv("TRINO_EXTRA_CREDENTIAL")
4650
self._cursor: Optional[Cursor] = None
4751

4852
if self.host is None:
@@ -56,13 +60,20 @@ def __init__(
5660

5761
def _get_cursor(self) -> Cursor:
5862
if self._cursor is None:
63+
headers = (
64+
{trino.constants.HEADER_EXTRA_CREDENTIAL: self.extra_credential}
65+
if self.extra_credential
66+
else {}
67+
)
5968
self._cursor = trino.dbapi.connect(
6069
host=self.host,
6170
port=self.port,
6271
user=self.user,
6372
catalog=self.catalog,
6473
auth=self.auth,
6574
http_scheme=self.http_scheme,
75+
source=self.source,
76+
http_headers=headers,
6677
).cursor()
6778

6879
return self._cursor

sdk/python/feast/infra/offline_stores/contrib/trino_offline_store/trino_source.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ def get_table_column_names_and_types(
228228
self, config: RepoConfig
229229
) -> Iterable[Tuple[str, str]]:
230230
client = Trino(
231-
user="user",
232231
catalog=config.offline_store.catalog,
233232
host=config.offline_store.host,
234233
port=config.offline_store.port,

0 commit comments

Comments
 (0)