-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trino CLI: support --extra-header parameter #15826
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an equivalent of this in the JDBC driver?
That's a good question - from a look at the docs, it appears not... At least not in Trino. Presto's JDBC client does support a This was discussed in #3179 but not implemented at the time, as user impersonation was implemented with explicit headers and covered the use-case of the original reporter. We're not using JDBC here so we only need this feature for the Trino CLI, but having support for extra headers in the code makes implementing this for JDBC easier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mixed feelings about adding this if it's not available in the JDBC driver. Let's wait for other reviewers to comment on this.
0143cd9
to
0339741
Compare
I would be surprised if this get approved. Trino generally does not allow flags to arbitrarily change core infrastructure like this. When we add features we like to start from the core problem and come up with a specific solution for that problem. |
@dain our usecase is we use presto-gateway to load-balance and front multiple trino clusters. we divide them into groups and would like to be able to use the trino-cli to issue queries to a specific group of clusters. I understand presto-gateway isn't core trino, but it is a fairly used system and more importantly this design pattern of having a gateway/load-balancer to allow for blue/green or rolling deployments of trino without causing downtime is necessary for us (and many others I'd imagine). We'd like all our tooling that issues requests to trino (including the trino-cli) to use this gateway and to be able to select a specific group of clusters. how would you suggest this be approached? should we modify presto-gateway to use a specific existing HTTP API client http header ? the only i see that is somewhat a candidate is |
Especially as Trino's own website lists the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs need an example
Is this PR dead or will it make it into the code base? |
Currently that depends on @Pluies to update and resolve the conflicts. Subsequently it can be reviewed again. |
@mosabua thanks for the ping, this was flying under my radar - updating now! |
Adds an --extra-header flag to the Trino CLI to allow for passing arbitrary HTTP headers to Trino requests.
0339741
to
f9d15ce
Compare
PR updated and ready for re-review 👍 @mosabua , there's an example in |
@electrum @dain @nineinchnick - can we decide on a direction for this. Does it maybe fit in given that we are working towards trino-gateway ? |
@msf could you suggest a name for a new header to be used for routing? |
I would suggest |
This comment was marked as resolved.
This comment was marked as resolved.
FYI, I just tested the approach of using
|
I opened a similar change in trinodb/trino-go-client#91 and was pointed to this PR. Depending on the environment and other systems at play, custom headers are a go-to way for passing information between systems. I have use cases for passing an |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
@bitsondatadev @colebow @mosabua Any chance the team at Trino can get some eyes on this? |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
I requested a review/decision on next steps from @electrum |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time. |
Interesting. Yet another feature I need. @mosabua |
@Pluies can you rebase this PR? I'll take a look :) I've refactored a lot of things around property handling to make these consistent across CLI/JDBC/Client so this will make sure that once you've add extra headers it will be supported there. |
Maybe we also have to add this to the JDBC driver |
oops manfred, I shared wrong line. here is the actual logic that checks if header args is passed on and starts with e.g. so here we can set `sql.Named('X-Trino-Routing-Group', 'groupLarge') to set trino routing group large |
Thank you @oneonestar .. I think we should figure out how we make this behavior consistent across all the clients .. at least the ones from the trinodb org .. so cli, jdbc, go, js, and python at this stage. I pinged @wendigo @martint and @electrum so we can discuss as needed and move this forward. |
Sorry I won't have bandwidth to rebase this until mid-December at the least, feel free to take over the PR or close this one and open another more recent one 🙏 |
Description
Adds an --extra-header flag to the Trino CLI to allow for passing arbitrary HTTP headers to Trino requests.
Additional context and related issues
This can be useful for all sort of header-y things, including passing the
X-Trino-Routing-Group
header for the presto-gateway, or adding specific values needed by other fanciful architectures. :)Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text: