Add config option to skip system schemas in JDBC connectors#24994
Add config option to skip system schemas in JDBC connectors#24994ZacBlanco merged 1 commit intoprestodb:masterfrom
Conversation
8605f5c to
f2074f6
Compare
presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/BaseJdbcConfig.java
Outdated
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
presto-mysql/src/main/java/com/facebook/presto/plugin/mysql/MySqlClient.java
Outdated
Show resolved
Hide resolved
f2074f6 to
bdeeece
Compare
steveburnett
left a comment
There was a problem hiding this comment.
LGTM! (docs)
Pull branch, local doc build, looks good. Thanks for the doc!
presto-singlestore/src/main/java/com/facebook/presto/plugin/singlestore/SingleStoreClient.java
Show resolved
Hide resolved
bdeeece to
72f87d6
Compare
| this.ignoredSystemSchemas = ImmutableSet.copyOf(Splitter.on(",").trimResults().omitEmptyStrings().split(ignoredSystemSchemas)); | ||
| return this; | ||
| } | ||
| public BaseJdbcConfig setIgnoredSystemSchemas(Set<String> ignoredSystemSchemas) |
| connectionProperties.setProperty("useUnicode", "true"); | ||
| connectionProperties.setProperty("characterEncoding", "utf8"); | ||
| connectionProperties.setProperty("tinyInt1isBit", "false"); | ||
| config.setIgnoredSystemSchemas(concat(config.getIgnoredSystemSchemas().stream(), mySqlConfig.getAdditionalIgnoredSchemas().stream()) |
There was a problem hiding this comment.
ImmutableSet.builder().addAll(set1).addAll(set2).build() is more succint
| return ignoredSystemSchemas; | ||
| } | ||
|
|
||
| @Config("ignored-system-schemas") |
There was a problem hiding this comment.
Lets call this config list-schemas-ignored-schemas or something similar to indicate how this set will be used
72f87d6 to
3b252ea
Compare
presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/BaseJdbcConfig.java
Outdated
Show resolved
Hide resolved
presto-mysql/src/main/java/com/facebook/presto/plugin/mysql/MySqlClient.java
Outdated
Show resolved
Hide resolved
5b281f0 to
d3d8750
Compare
ZacBlanco
left a comment
There was a problem hiding this comment.
LGTM, but let's be a little more descriptive in the documentation
d3d8750 to
cff5f77
Compare
3c2c51a to
9a88ea0
Compare
imjalpreet
left a comment
There was a problem hiding this comment.
Thanks for the PR, I had a couple of suggestions.
| String schemaName = resultSet.getString("TABLE_SCHEM"); | ||
| // skip internal schemas | ||
| if (!schemaName.equalsIgnoreCase("information_schema")) { | ||
| if (!listSchemasIgnoredSchemas.contains(schemaName)) { |
There was a problem hiding this comment.
In order to maintain the same behaviour as before, we should probably do a case-insensitive match here. Since the default value is lower case "information_schema", it won't match with non-lower case schema name like it would have earlier.
There was a problem hiding this comment.
Changed it so that values added are automatically lowercase & changed the schemaName to lowercase
| String schemaName = resultSet.getString("TABLE_CAT"); | ||
| // skip internal schemas | ||
| if (!schemaName.equalsIgnoreCase("information_schema") && !schemaName.equalsIgnoreCase("mysql")) { | ||
| if (!listSchemasIgnoredSchemas.contains(schemaName)) { |
There was a problem hiding this comment.
Same here, we should try to maintain the same behaviour as before.
c2d84f2 to
4f41443
Compare
Co-authored-by: Susan Philip <70162360+SusanPhilip@users.noreply.github.com>
4f41443 to
2669785
Compare
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff f9c336d...2669785. No notifications. |
imjalpreet
left a comment
There was a problem hiding this comment.
LGTM.
We might have to modify the implementation a bit when mixed case support is added.
Description
Adds an option to skip schemas in JDBC connectors
Motivation and Context
Will allow users to skip system schemas in connectors
Impact
New config added
Test Plan
UTs
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.