Skip to content

Commit

Permalink
SNOW-1619625: Add exact search for schema (#2012)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz authored Feb 4, 2025
1 parent 4d73661 commit 0607465
Show file tree
Hide file tree
Showing 5 changed files with 432 additions and 92 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 @@ -1091,6 +1096,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 @@ -510,6 +510,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 @@ -95,6 +95,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 0607465

Please sign in to comment.