Skip to content

Commit

Permalink
SNOW-1636286: Add exact search for schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz committed Dec 19, 2024
1 parent b3a2763 commit aa61f94
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 64 deletions.
13 changes: 13 additions & 0 deletions src/main/java/net/snowflake/client/core/SFBaseSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public abstract class SFBaseSession {
// we need to allow for it to maintain backwards compatibility.
private boolean enablePatternSearch = true;

// Enables the use of exact schema searches for certain DatabaseMetaData methods
// that should use schema from context (CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX=true)
// value is false for backwards compatibility.
private boolean enableExactSchemaSearch = false;

/** Disable lookup for default credentials by GCS library */
private boolean disableGcsDefaultCredentials = false;

Expand Down Expand Up @@ -1069,6 +1074,14 @@ public void setEnablePatternSearch(boolean enablePatternSearch) {
this.enablePatternSearch = enablePatternSearch;
}

public boolean getEnableExactSchemaSearch() {
return enableExactSchemaSearch;
}

void setEnableExactSchemaSearch(boolean enableExactSchemaSearch) {
this.enableExactSchemaSearch = enableExactSchemaSearch;
}

public boolean getDisableGcsDefaultCredentials() {
return disableGcsDefaultCredentials;
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/snowflake/client/core/SFSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,13 @@ public void addSFSessionProperty(String propertyName, Object propertyValue) thro
setEnablePatternSearch(getBooleanValue(propertyValue));
}
break;

case ENABLE_EXACT_SCHEMA_SEARCH_ENABLED:
if (propertyValue != null) {
setEnableExactSchemaSearch(getBooleanValue(propertyValue));
}
break;

case DISABLE_GCS_DEFAULT_CREDENTIALS:
if (propertyValue != null) {
setDisableGcsDefaultCredentials(getBooleanValue(propertyValue));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public enum SFSessionProperty {
DIAGNOSTICS_ALLOWLIST_FILE("DIAGNOSTICS_ALLOWLIST_FILE", false, String.class),

ENABLE_PATTERN_SEARCH("enablePatternSearch", false, Boolean.class),
ENABLE_EXACT_SCHEMA_SEARCH_ENABLED("ENABLE_EXACT_SCHEMA_SEARCH_ENABLED", false, Boolean.class),

DISABLE_GCS_DEFAULT_CREDENTIALS("disableGcsDefaultCredentials", false, Boolean.class),

Expand Down
Loading

0 comments on commit aa61f94

Please sign in to comment.