public abstract class SFBaseSession extends Object
New connection properties and session parameters can be added here, as SFBaseSession contains the logic for storing, setting, and getting these session properties.
For logic that is specific to a particular type of Session, four methods need to be implemented:
open(), for establishing a connection. close(), for closing a connection. isSafeToClose(), for checking whether the connection can be closed. checkProperties(), invoked at connection time to verify if the requisite properties are set; and if not, returns a list of missing properties raiseError(), which handles exceptions that may be raised in the session isTelemetryEnabled(), which signals whether to enable client telemetry
| Modifier and Type | Field and Description |
|---|---|
protected int |
heartbeatFrequency |
static long |
MEMORY_LIMIT_UNSET |
protected List<SFException> |
sqlWarnings |
| Modifier | Constructor and Description |
|---|---|
protected |
SFBaseSession(SFConnectionHandler sfConnectionHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
addProperty(SFSessionProperty sfSessionProperty,
Object propertyValue)
Wrapper function for the other addProperty(String, Object) method that takes an
SFSessionProperty instead of a String key.
|
void |
addProperty(String propertyName,
Object propertyValue)
Adds a connection property to the connection-properties map.
|
abstract void |
callHeartBeat(int timeout)
Makes a heartbeat call to check for session validity.
|
abstract List<DriverPropertyInfo> |
checkProperties()
Validates the connection properties used by this session, and returns a list of missing
properties.
|
void |
clearSqlWarnings()
JDBC API.
|
abstract void |
close()
Close the connection
|
String |
getArrayBindStage() |
int |
getArrayBindStageThreshold() |
abstract int |
getAuthTimeout() |
boolean |
getAutoCommit() |
Properties |
getClientInfo()
Part of the JDBC API, where client applications may fetch a Map of Properties to set various
attributes.
|
String |
getClientInfo(String name)
Gets the Property associated with the key 'name' in the ClientInfo map.
|
int |
getClientMemoryLimit() |
int |
getClientPrefetchThreads() |
int |
getClientResultChunkSize() |
Map<SFSessionProperty,Object> |
getConnectionPropertiesMap() |
int |
getConservativeMemoryAdjustStep() |
String |
getDatabase() |
int |
getDatabaseMajorVersion() |
int |
getDatabaseMinorVersion() |
String |
getDatabaseVersion() |
boolean |
getEnableCombineDescribe() |
boolean |
getEnableHeartbeat() |
boolean |
getFormatDateWithTimezone() |
int |
getHeartbeatFrequency()
Retrieve session heartbeat frequency in seconds
|
abstract int |
getHttpClientConnectionTimeout() |
HttpClientSettingsKey |
getHttpClientKey() |
abstract int |
getHttpClientSocketTimeout() |
String |
getInjectFileUploadFailure() |
int |
getInjectWaitInPut() |
long |
getMemoryLimitForTesting() |
boolean |
getMetadataRequestUseConnectionCtx() |
boolean |
getMetadataRequestUseSessionDatabase() |
abstract int |
getNetworkTimeoutInMilli() |
OCSPMode |
getOCSPMode() |
Object |
getOtherParameter(String key) |
boolean |
getPreparedStatementLogging() |
String |
getQueryContext() |
Integer |
getQueryTimeout() |
String |
getRole() |
String |
getSchema() |
String |
getServerUrl() |
String |
getServiceName() |
String |
getSessionId()
Returns a unique id for this session.
|
Object |
getSessionPropertyByKey(String propertyName)
Fetch the value for a custom session property.
|
SFConnectionHandler |
getSfConnectionHandler() |
abstract SnowflakeConnectString |
getSnowflakeConnectionString() |
List<SFException> |
getSqlWarnings()
JDBC API.
|
boolean |
getStoreTemporaryCredential() |
abstract Telemetry |
getTelemetryClient()
Returns the telemetry client, if supported, by this session.
|
SnowflakeType |
getTimestampMappedType() |
boolean |
getTreatNTZAsUTC() |
String |
getUrl() |
String |
getUser() |
boolean |
getUseRegionalS3EndpointsForPresignedURL() |
boolean |
getUseSessionTimezone() |
boolean |
getValidateDefaultParameters() |
String |
getWarehouse() |
abstract boolean |
isAsyncSession() |
boolean |
isClientTelemetryEnabled() |
boolean |
isConservativeMemoryUsageEnabled() |
boolean |
isJdbcTreatDecimalAsInt() |
boolean |
isResultColumnCaseInsensitive() |
abstract boolean |
isSafeToClose()
Function that checks if the active session can be closed when the connection is closed.
|
boolean |
isSfSQLMode() |
boolean |
isStringQuoted() |
abstract void |
raiseError(Throwable exc,
String jobId,
String requestId)
Raise an error within the current session.
|
void |
setArrayBindStage(String arrayBindStage) |
void |
setArrayBindStageThreshold(int arrayBindStageThreshold) |
void |
setAutoCommit(boolean autoCommit) |
void |
setClientMemoryLimit(int clientMemoryLimit) |
void |
setClientPrefetchThreads(int clientPrefetchThreads) |
void |
setClientResultChunkSize(int clientResultChunkSize) |
void |
setClientTelemetryEnabled(boolean clientTelemetryEnabled) |
void |
setConservativeMemoryAdjustStep(int conservativeMemoryAdjustStep) |
void |
setDatabase(String database) |
void |
setDatabaseMajorVersion(int databaseMajorVersion) |
void |
setDatabaseMinorVersion(int databaseMinorVersion) |
void |
setDatabaseVersion(String databaseVersion) |
void |
setEnableCombineDescribe(boolean enableCombineDescribe) |
void |
setEnableConservativeMemoryUsage(boolean enableConservativeMemoryUsage) |
void |
setEnableHeartbeat(boolean enableHeartbeat) |
void |
setFormatDateWithTimezone(boolean formatDateWithTimezone) |
void |
setHeartbeatFrequency(int frequency)
Set the heartbeat frequency in seconds.
|
void |
setInjectedDelay(int injectedDelay) |
void |
setInjectFileUploadFailure(String fileToFail) |
void |
setJdbcTreatDecimalAsInt(boolean jdbcTreatDecimalAsInt) |
void |
setMemoryLimitForTesting(long memLimit) |
void |
setMetadataRequestUseConnectionCtx(boolean enabled) |
void |
setMetadataRequestUseSessionDatabase(boolean enabled) |
void |
setOtherParameter(String key,
Object value) |
void |
setPreparedStatementLogging(boolean value) |
void |
setQueryContext(String queryContext) |
void |
setResultColumnCaseInsensitive(boolean resultColumnCaseInsensitive) |
void |
setRole(String role) |
void |
setSchema(String schema) |
void |
setServiceName(String serviceName) |
void |
setSessionId(String sessionId)
Sets the session-id attribute in this session.
|
void |
setSessionPropertyByKey(String propertyName,
Object propertyValue)
Enables setting a value in the custom-properties map.
|
void |
setSfSQLMode(boolean sfSQLMode) |
void |
setStoreTemporaryCredential(boolean storeTemporaryCredential) |
void |
setTimestampMappedType(SnowflakeType timestampMappedType) |
void |
setTreatNTZAsUTC(boolean treatNTZAsUTC) |
void |
setUseRegionalS3EndpointsForPresignedURL(boolean regionalS3Endpoint) |
void |
setUseSessionTimezone(boolean useSessionTimezone) |
void |
setValidateDefaultParameters(boolean validateDefaultParameters) |
void |
setWarehouse(String warehouse) |
void |
unsetInvalidProxyHostAndPort() |
protected List<SFException> sqlWarnings
protected int heartbeatFrequency
public static long MEMORY_LIMIT_UNSET
protected SFBaseSession(SFConnectionHandler sfConnectionHandler)
public void setMemoryLimitForTesting(long memLimit)
public long getMemoryLimitForTesting()
public Properties getClientInfo()
public String getClientInfo(String name)
name - The key from which to fetch the Property.public String getSessionId()
public void setSessionId(String sessionId)
sessionId - The session id as a string.public boolean isSfSQLMode()
public void setSfSQLMode(boolean sfSQLMode)
public String getDatabaseVersion()
public void setDatabaseVersion(String databaseVersion)
public int getDatabaseMajorVersion()
public void setDatabaseMajorVersion(int databaseMajorVersion)
public int getDatabaseMinorVersion()
public void setDatabaseMinorVersion(int databaseMinorVersion)
public boolean getPreparedStatementLogging()
public void setPreparedStatementLogging(boolean value)
public String getInjectFileUploadFailure()
public void setInjectFileUploadFailure(String fileToFail)
public SnowflakeType getTimestampMappedType()
public void setTimestampMappedType(SnowflakeType timestampMappedType)
public boolean isResultColumnCaseInsensitive()
public void setResultColumnCaseInsensitive(boolean resultColumnCaseInsensitive)
public boolean isJdbcTreatDecimalAsInt()
public void setJdbcTreatDecimalAsInt(boolean jdbcTreatDecimalAsInt)
public String getServerUrl()
public boolean isStringQuoted()
public void addProperty(SFSessionProperty sfSessionProperty, Object propertyValue) throws SFException
sfSessionProperty - The property for which to set the value.propertyValue - The value to set for the property.SFException - If the value already exists for the given key (should only be set once), or
if the value is invalid.public void addProperty(String propertyName, Object propertyValue) throws SFException
propertyName - The name of the property, as a string. Recognized ones are defined in the
SFSessionProperty enum.propertyValue - The value to set for this key.SFException - If the value already exists for the given key (should only be set once), or
if the value is invalid.public Map<SFSessionProperty,Object> getConnectionPropertiesMap()
public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException
SnowflakeSQLExceptionpublic void unsetInvalidProxyHostAndPort()
public OCSPMode getOCSPMode()
public Integer getQueryTimeout()
public String getUser()
public String getUrl()
public int getInjectWaitInPut()
public boolean getMetadataRequestUseSessionDatabase()
public void setMetadataRequestUseSessionDatabase(boolean enabled)
public boolean getMetadataRequestUseConnectionCtx()
public void setMetadataRequestUseConnectionCtx(boolean enabled)
public void setInjectedDelay(int injectedDelay)
public boolean getTreatNTZAsUTC()
public void setTreatNTZAsUTC(boolean treatNTZAsUTC)
public boolean getEnableHeartbeat()
public void setEnableHeartbeat(boolean enableHeartbeat)
public void setHeartbeatFrequency(int frequency)
frequency - heartbeat frequency in secondspublic int getHeartbeatFrequency()
public boolean getAutoCommit()
public void setAutoCommit(boolean autoCommit)
public boolean getFormatDateWithTimezone()
public void setFormatDateWithTimezone(boolean formatDateWithTimezone)
public boolean getUseSessionTimezone()
public void setUseSessionTimezone(boolean useSessionTimezone)
public boolean getEnableCombineDescribe()
public void setEnableCombineDescribe(boolean enableCombineDescribe)
public boolean isClientTelemetryEnabled()
public void setClientTelemetryEnabled(boolean clientTelemetryEnabled)
public int getArrayBindStageThreshold()
public void setArrayBindStageThreshold(int arrayBindStageThreshold)
public boolean getStoreTemporaryCredential()
public void setStoreTemporaryCredential(boolean storeTemporaryCredential)
public String getServiceName()
public void setServiceName(String serviceName)
public void setEnableConservativeMemoryUsage(boolean enableConservativeMemoryUsage)
public boolean isConservativeMemoryUsageEnabled()
public int getConservativeMemoryAdjustStep()
public void setConservativeMemoryAdjustStep(int conservativeMemoryAdjustStep)
public int getClientMemoryLimit()
public void setClientMemoryLimit(int clientMemoryLimit)
public int getClientResultChunkSize()
public void setClientResultChunkSize(int clientResultChunkSize)
public int getClientPrefetchThreads()
public void setClientPrefetchThreads(int clientPrefetchThreads)
public boolean getValidateDefaultParameters()
public void setValidateDefaultParameters(boolean validateDefaultParameters)
public String getDatabase()
public void setDatabase(String database)
public String getSchema()
public void setSchema(String schema)
public String getRole()
public void setRole(String role)
public String getWarehouse()
public void setWarehouse(String warehouse)
public void setUseRegionalS3EndpointsForPresignedURL(boolean regionalS3Endpoint)
public boolean getUseRegionalS3EndpointsForPresignedURL()
public String getArrayBindStage()
public void setArrayBindStage(String arrayBindStage)
public void setSessionPropertyByKey(String propertyName, Object propertyValue)
propertyName - A string key for the property to set.propertyValue - The property value.public Object getSessionPropertyByKey(String propertyName)
propertyName - The key of the session property to fetch.public abstract boolean isSafeToClose()
public abstract List<DriverPropertyInfo> checkProperties()
public abstract void close()
throws SFException,
SnowflakeSQLException
SnowflakeSQLException - if failed to close the connectionSFException - if failed to close the connectionpublic abstract void raiseError(Throwable exc, String jobId, String requestId)
exc - The throwable exceptionjobId - jobId that failedrequestId - requestId that failedpublic abstract Telemetry getTelemetryClient()
public abstract void callHeartBeat(int timeout)
throws Exception,
SFException
ExceptionSFExceptionpublic List<SFException> getSqlWarnings()
public void clearSqlWarnings()
public SFConnectionHandler getSfConnectionHandler()
public abstract int getNetworkTimeoutInMilli()
public abstract int getAuthTimeout()
public abstract SnowflakeConnectString getSnowflakeConnectionString()
public abstract int getHttpClientConnectionTimeout()
public abstract int getHttpClientSocketTimeout()
public abstract boolean isAsyncSession()
public String getQueryContext()
public void setQueryContext(String queryContext)
Copyright © 2022. All rights reserved.