Skip to content

Commit 0728463

Browse files
ammararvmallya-123
authored andcommitted
fix: Add X-Trino-Extra-Credential header and remove user override (feast-dev#3246)
* do changes with signing Signed-off-by: ammarar <ammar.alrashed@gmail.com> * lint fix Signed-off-by: ammarar <ammar.alrashed@gmail.com> Signed-off-by: ammarar <ammar.alrashed@gmail.com>
1 parent e93367b commit 0728463

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

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
@@ -226,7 +226,6 @@ def get_table_column_names_and_types(
226226
self, config: RepoConfig
227227
) -> Iterable[Tuple[str, str]]:
228228
client = Trino(
229-
user="user",
230229
catalog=config.offline_store.catalog,
231230
host=config.offline_store.host,
232231
port=config.offline_store.port,

0 commit comments

Comments
 (0)