-
Notifications
You must be signed in to change notification settings - Fork 26
Feature/ticketless client tags in query editor #317
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
base: main
Are you sure you want to change the base?
Feature/ticketless client tags in query editor #317
Conversation
|
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
|
Cla was accepted waiting for #309 before i can publish this @laserninja @RoeyoOgen |
pkg/trino/datasource.go
Outdated
| clientTags := ctx.Value(trinoClientTagsKey) | ||
|
|
||
| if user != nil { | ||
| headers.Set("X-Trino-User", string(user.(*backend.User).Login)) |
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.
Why is this necessary?
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.
nope, removed
src/e2e.test.ts
Outdated
| async function setupDataSourceWithAccessToken(page: Page) { | ||
| await page.getByTestId('data-testid Datasource HTTP settings url').fill('http://trino:8080'); | ||
| await page.locator('div').filter({hasText: /^Impersonate logged in userAccess token$/}).getByLabel('Toggle switch').click(); | ||
| await page.locator('#trino-settings-enable-impersonation').click({ force: true }); |
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.
Why is force: true necessary?
README.md
Outdated
| * Raw SQL editor only, no query builder yet | ||
| * Macros | ||
| * Client tags support, used to identify resource groups. | ||
| * ``` |
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.
What's this?
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.
left overs from #309
pkg/trino/datasource-context.go
Outdated
| } | ||
| if queryTags.ClientTags != "" { | ||
| contextWithTags = context.WithValue(contextWithTags, trinoClientTagsKey, queryTags.ClientTags) | ||
| fmt.Printf("Using client tag from query editor: %s\n", queryTags.ClientTags) |
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.
Remove this
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.
done
pkg/trino/datasource-context.go
Outdated
|
|
||
| if contextWithTags.Value(trinoClientTagsKey) == nil && settings.ClientTags != "" { | ||
| contextWithTags = context.WithValue(contextWithTags, trinoClientTagsKey, settings.ClientTags) | ||
| fmt.Printf("Using client tag from datasource settings: %s\n", settings.ClientTags) |
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.
Remove this
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.
done
| return ds.SQLDatasource.QueryData(ctx, req) | ||
| } | ||
|
|
||
| func (ds *SQLDatasourceWithTrinoUserContext) injectClientTags(contextWithTags context.Context, req *backend.QueryDataRequest, settings models.TrinoDatasourceSettings) context.Context { |
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.
You're not referencing ds anywhere, so this method doesn't need to be bound to it. Remove (ds *SQLDatasourceWithTrinoUserContext), and place it after injectAccessToken.
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.
done
pkg/trino/datasource.go
Outdated
| return args | ||
| } | ||
|
|
||
|
|
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.
Remove this extra line
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.
done
pkg/trino/datasource-context.go
Outdated
| return nil, fmt.Errorf("user can't be nil if impersonation is enabled") | ||
| } | ||
|
|
||
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.
Remove these spaces
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.
done
|
Please squash all commits |
|
@laserninja sadly my code based on your changes, i will pull your changes after you finish the cr process |
904a534 to
c699b9e
Compare
|
@nineinchnick done replying and fixing, thanks for the cr. |
8bb3509 to
61c6a88
Compare
|
Hi @nineinchnick stil needs second cr 🙏🏻 |
Allows to override the client tags that were set in the data source addition , via the the query editor.
Based on pr #309 by @laserninja that allows setting the client tags in the data source addition .