-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add JDBC connection current catalog fallback parameter #20866
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
Add JDBC connection current catalog fallback parameter #20866
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 |
hashhar
left a comment
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.
LGTM % comments
cc: @electrum this implements the idea mentioned at #16361 (comment) so thought you might want to take a look too.
client/trino-jdbc/src/test/java/io/trino/jdbc/TestTrinoDatabaseMetaData.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoDatabaseMetaData.java
Outdated
Show resolved
Hide resolved
|
also re: commit message, consider this suggestion (i.e. describe why the change is being made and what the change is). |
d6d7ddb to
1dfa38f
Compare
|
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-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
client/trino-jdbc/src/test/java/io/trino/jdbc/TestTrinoDatabaseMetaData.java
Outdated
Show resolved
Hide resolved
|
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. |
|
This is something we want to merge, but we struggle to reproduce the problem it is fixing. |
should be easy with a mock connector |
1dfa38f to
54c8185
Compare
|
rebased on master + cleaned up the test a bit |
client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoDatabaseMetaData.java
Outdated
Show resolved
Hide resolved
Some BI tools don't pass a `catalog` when calling the `DatabaseMetaData` `getTables`, `getColumns` and `getSchemas` methods. This makes the JDBC driver search across all catalogs which can be expensive. This commit introduces a new boolean connection property `assumeNullCatalogMeansCurrentCatalog` (disabled by default) to be used with such BI tools. If enabled the driver will try to use current `catalog` of the JDBC connection when fetching Trino metadata like `getTables`, `getColumns`, `getSchemas` if the `catalog` argument to those methods is passed as `null`. Co-authored-by: Rafał Połomka <[email protected]> Co-authored-by: Ashhar Hasan <[email protected]>
54c8185 to
bd098d8
Compare
hashhar
left a comment
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.
LGTM. (No code changes from what was reviewed - rebased on master and just a var rename from Piotr's feedback).
|
Ignore this, we already have |
mosabua
left a comment
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.
Dont we need to document this behavior? Also will this affect the CLI and the JDBC driver? How do we organize farming this change out to other drivers/clients?
|
We can document but it's something for exceptional cases (e.g. BI tools that misuse the DatabaseMetaData APIs, similar to Doesn't affect either the CLI/JDBC unless enabled. |
|
Lets leave it as an internal, experts-only thing for now then, and keep an eye out if this problems comes up again. |
Description
This commit introduces fallback (disabled by default), which will try to use
catalogvalue passed through JDBC connection when fetching Trino metadata like:getTables,getColumns,getSchemaswithcatalogset tonull.Additional context and related issues
Release notes
( ) This is not user-visible or is 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: