-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add support for appending queries in sql based connectors #16308
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
Conversation
Hello, @s2lomon I need to document this feature and am hoping you can assist me. What must a user do to implement this? |
@hashhar Can you please help here? |
Ack, I'll share a short summary here later today. |
@Jessie212 we've been using this in production so figured I would share my notes on it. We have been using it with Oracle and SQLServer but any JDBC based connector supports it. The config we are using in our catalog properties is:
You can specify any format for the query comment; we just chose to go with a comma-separated format. There is also an ability to add a |
To add some more context, if As example with /* query_id: <query_id>, source: <source>, username: <user>, may your query succeed */ <actual_query_sent_by_trino> The goal is to allow admins to log query on the datasource so they can correlate which queries come from where and are part of which query id on Trino side. |
Actually I believe that the comment is added at the end of the query @hashhar and there are no spaces between /* and */ |
oh yes, it gets appended to the end https://github.com/trinodb/trino/pull/14500/files#diff-45098b72713117f087df848fb61feb4d1b6a26e84113908efba191743d6f50aeR48 So |
I think that also it's good to mention, that since it's a standard Trino property, we can add env vars to the format, enriching the meta information about the requests. |
161db88
to
bbc114a
Compare
I'm not sure we need this level of explanation or if examples are necessary, but that depends on where this content ends up. |
bbc114a
to
f9153da
Compare
f9153da
to
eda0eab
Compare
I've cautiously added the content as a fragment, and applied it to the SQL Server and Oracle connectors. I would like to know if it's safe to include this fragment to the rest of the JDBC connectors? |
That is tricky question. From point of view Trino the same code applies to all JDBC connectors. However it is vendor specific as this appendix can be removed either by vendor specific JDBC driver or logging of the query could lose it. We can either add it to all and risk that some of them are actually not supported. Or safely document only those that we are sure that are supported. I would prefer the former. |
I agree with @kokosing .. we should put the burden on the user and document them for all connectors where it applies with a warning that it might not work for the reasons he outlines. Users can then test and confirm. Also ... it might work in some scenarios with a connector and not work with the same connector in others.. |
eda0eab
to
85d9655
Compare
Please reword or set up a meeting with me to collaborate @Jessie212 |
411644c
to
7f346ac
Compare
Please squash commits and improve commit message @Jessie212 |
78f4c87
to
c1efdc8
Compare
c1efdc8
to
f70dd0a
Compare
f70dd0a
to
5d658ed
Compare
5d658ed
to
10b89ad
Compare
Description
Document added support for appending queries with context in sql based connectors.
Additional context and related issues
#14500
Release notes
(x) 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.
( ) Release notes are required, with the following suggested text: