Title: The use of JWT in Trino offline store failes · Issue #6760 · feast-dev/feast · GitHub
Open Graph Title: The use of JWT in Trino offline store failes · Issue #6760 · feast-dev/feast
X Title: The use of JWT in Trino offline store failes · Issue #6760 · feast-dev/feast
Description: Expected Behavior The call of def run_get_historical below should be able to reach trino. Current Behavior Unable to use a jwt token to authenticate against trino. Steps to reproduce Offline store like: offline_store: type: trino ... use...
Open Graph Description: Expected Behavior The call of def run_get_historical below should be able to reach trino. Current Behavior Unable to use a jwt token to authenticate against trino. Steps to reproduce Offline store ...
X Description: Expected Behavior The call of def run_get_historical below should be able to reach trino. Current Behavior Unable to use a jwt token to authenticate against trino. Steps to reproduce Offline store ...
Opengraph URL: https://github.com/feast-dev/feast/issues/6760
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The use of JWT in Trino offline store failes","articleBody":"## Expected Behavior \n\nThe call of def run_get_historical below should be able to reach trino.\n\n\n## Current Behavior\n\nUnable to use a jwt token to authenticate against trino.\n\n## Steps to reproduce\nOffline store like:\n\n```\noffline_store:\n type: trino\n...\n user: xyz\n # Enables authentication in Trino connections, pick the one you need\n auth:\n type: jwt\n config:\n token: ${TRINO_JWT_TOKEN}\n\n```\nSetting the variable like with an inhouse keycloak instance:\n\n```\nexport TRINO_JWT_TOKEN=$(curl --location 'https://foo.bar/' \\\n --header 'Content-Type: application/x-www-form-urlencoded' \\\n --data-urlencode 'username=\u003cUSER_NAME>' \\\n --data-urlencode 'password=\u003cPASSWORD>' | jq -r '.access_token')\n```\n\nRunning a historical query\n\n```\ndef run_get_historical(a_date):\n import pandas as pd\n entity_df = pd.DataFrame(\n {\n \"schadennr\": [\"123\", \"456\"],\n \"event_timestamp\": [a_date, a_date],\n }\n )\n feature_df = store.get_historical_features(\n entity_df=entity_df,\n features=store.get_feature_service(\"train_service\")\n ).to_df()\n print(feature_df.head(3).drop(columns=[\"schadennr\"]))\n\n # a_date: Optional[Union[str, datetime]] = None\n\ndef main() -> int:\n an_optional_date_string = sys.argv[1] if len(sys.argv) > 1 else None\n if an_optional_date_string is None:\n a_date = datetime.now()\n print(a_date)\n elif isinstance(an_optional_date_string, str):\n a_date = datetime.strptime(an_optional_date_string, \"%Y-%m-%d\")\n print(a_date)\n else:\n raise ValueError(\"Invalid date format. Please provide a date string in 'YYYY-MM-DD' format.\")\n run_get_historical(a_date)\n return 0\n\nif __name__ == \"__main__\":\n raise SystemExit(main())\n\n```\n\nFails with:\n\n```\n$ python run_feast_offline_query.py\n2026-08-19 16:01:27.655863\nTraceback (most recent call last):\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/trino_project/feature_repo/run_feast_offline_query.py\", line 48, in \u003cmodule>\n raise SystemExit(main())\n ^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/trino_project/feature_repo/run_feast_offline_query.py\", line 44, in main\n run_get_historical(a_date)\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/trino_project/feature_repo/run_feast_offline_query.py\", line 26, in run_get_historical\n feature_df = store.get_historical_features(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/feast/feature_store.py\", line 2025, in get_historical_features\n job = provider.get_historical_features(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/feast/infra/passthrough_provider.py\", line 481, in get_historical_features\n job = self.offline_store.get_historical_features(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/feast/infra/offline_stores/contrib/trino_offline_store/trino.py\", line 371, in get_historical_features\n entity_schema = _upload_entity_df_and_get_entity_schema(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/feast/infra/offline_stores/contrib/trino_offline_store/trino.py\", line 515, in _upload_entity_df_and_get_entity_schema\n upload_pandas_dataframe_to_trino(\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/feast/infra/offline_stores/contrib/trino_offline_store/connectors/upload.py\", line 180, in upload_pandas_dataframe_to_trino\n client.execute_query(\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/feast/infra/offline_stores/contrib/trino_offline_store/trino_queries.py\", line 87, in execute_query\n return query.execute()\n ^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/feast/infra/offline_stores/contrib/trino_offline_store/trino_queries.py\", line 105, in execute\n self._cursor.execute(operation=self.query_text)\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/trino/dbapi.py\", line 642, in execute\n self._iterator = iter(self._query.execute())\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/trino/client.py\", line 952, in execute\n response = self._request.post(self._query, additional_http_headers)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/trino/client.py\", line 681, in post\n http_response = self._post(\n ^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/trino/client.py\", line 1107, in decorated\n raise error\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/trino/client.py\", line 1089, in decorated\n result = func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/requests/sessions.py\", line 712, in post\n return self.request(\"POST\", url, data=data, json=json, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/requests/sessions.py\", line 635, in request\n prep = self.prepare_request(req)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/requests/sessions.py\", line 541, in prepare_request\n p.prepare(\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/requests/models.py\", line 443, in prepare\n self.prepare_auth(auth, url)\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/requests/models.py\", line 689, in prepare_auth\n r = auth_handler(self)\n ^^^^^^^^^^^^^^^^^^\n File \"/home/xyz/bitbucket-repos/dat/xyz_feast/.venv/lib/python3.11/site-packages/trino/auth.py\", line 257, in __call__\n r.headers[\"Authorization\"] = \"Bearer \" + self.token\n ~~~~~~~~~~^~~~~~~~~~~~\nTypeError: can only concatenate str (not \"SecretStr\") to str\n```\n\n### Specifications\n\n- Version: feast 0.65.0\n- Platform: RHEL 9.8 (Plow), 5.14.0-687.17.1.el9_8.x86_64\n- Subsystem: \n\n## Possible Solution\n\nWhen patching the code like:\n\n```\n_original_init = trino.auth.JWTAuthentication.__init__\n\n\ndef _patched_init(self, token):\n if hasattr(token, \"get_secret_value\"):\n token = token.get_secret_value()\n _original_init(self, str(token))\n\n\ntrino.auth.JWTAuthentication.__init__ = _patched_init\n```\n\nbefore our code runs, ensures that the call to trino succeeds.\n\nSomehow the token gets packed into a SecretStr but when the python code wants to use the token, it expects it to be a simple string.","author":{"url":"https://github.com/kow-butterfly","@type":"Person","name":"kow-butterfly"},"datePublished":"2026-08-19T14:28:01Z","url":"https://github.com/feast-dev/feast/issues/6760"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b8f3fdfa-f301-a9f7-f2d8-175c444ecd45 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E1EE:1B2C16:1001BC0:15BE471:6AFE9817 |
| html-safe-nonce | 5c00de3a6d2a40e5a7a022294998bdb56577d95f44978e80c9742259fa4b5a71 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUVFOjFCMkMxNjoxMDAxQkMwOjE1QkU0NzE6NkFGRTk4MTciLCJ2aXNpdG9yX2lkIjoiNjg5MTcyOTE4NjY1ODg4MzYwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bb9524c1611ab97989eb176061d587e41eaaa4886ccaa738f82740c9848ace2f |
| hovercard-subject-tag | issue:5193743607 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/feast-dev/feast/6760/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b5a08d64c60f0d7d241cd0a1a482589eaa0ec219a7758028ce0f7f23308168c/feast-dev/feast/issues/6760 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b5a08d64c60f0d7d241cd0a1a482589eaa0ec219a7758028ce0f7f23308168c/feast-dev/feast/issues/6760 |
| og:image:alt | Expected Behavior The call of def run_get_historical below should be able to reach trino. Current Behavior Unable to use a jwt token to authenticate against trino. Steps to reproduce Offline store ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kow-butterfly |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width