public class SFSession extends SFBaseSession
| Modifier and Type | Field and Description |
|---|---|
protected Set<String> |
activeAsyncQueries |
static String |
SF_HEADER_AUTHORIZATION |
static String |
SF_HEADER_SNOWFLAKE_AUTHTYPE |
static String |
SF_HEADER_TOKEN_TAG |
static String |
SF_QUERY_REQUEST_ID |
heartbeatFrequency, MEMORY_LIMIT_UNSET, sqlWarnings| Constructor and Description |
|---|
SFSession() |
SFSession(DefaultSFConnectionHandler sfConnectionHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSFSessionProperty(String propertyName,
Object propertyValue)
Add a property If a property is known for connection, add it to connection properties If not,
add it as a dynamic session parameters
|
void |
callHeartBeat(int timeout)
Makes a heartbeat call to check for session validity.
|
List<DriverPropertyInfo> |
checkProperties()
Validates the connection properties used by this session, and returns a list of missing
properties.
|
void |
close()
Close the connection
|
void |
closeTelemetryClient() |
boolean |
containProperty(String key) |
protected int |
getAndIncrementSequenceId() |
int |
getAuthTimeout() |
boolean |
getEnableCombineDescribe() |
int |
getHttpClientConnectionTimeout() |
int |
getHttpClientSocketTimeout() |
String |
getIdToken() |
int |
getInjectClientPause() |
int |
getInjectSocketTimeout() |
String |
getMfaToken() |
int |
getNetworkTimeoutInMilli() |
QueryStatus |
getQueryStatus(String queryID) |
String |
getSessionToken()
get session token
|
SnowflakeConnectString |
getSnowflakeConnectionString() |
Telemetry |
getTelemetryClient()
Returns the telemetry client, if supported, by this session.
|
protected void |
heartbeat()
Send heartbeat for the session
|
boolean |
isAsyncSession() |
boolean |
isClosed() |
boolean |
isSafeToClose()
Function that checks if the active session can be closed when the connection is closed.
|
void |
open()
Open a new database session
|
void |
raiseError(Throwable exc,
String jobId,
String requestId)
Raise an error within the current session.
|
void |
setEnableCombineDescribe(boolean enable) |
void |
setInjectClientPause(int injectClientPause) |
void |
setInjectSocketTimeout(int injectSocketTimeout) |
void |
setSnowflakeConnectionString(SnowflakeConnectString connStr) |
protected void |
startHeartbeatForThisSession()
Start heartbeat for this session
|
protected void |
stopHeartbeatForThisSession()
Stop heartbeat for this session
|
addProperty, addProperty, clearSqlWarnings, getArrayBindStage, getArrayBindStageThreshold, getAutoCommit, getClientInfo, getClientInfo, getClientMemoryLimit, getClientPrefetchThreads, getClientResultChunkSize, getConnectionPropertiesMap, getConservativeMemoryAdjustStep, getDatabase, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseVersion, getEnableHeartbeat, getFormatDateWithTimezone, getHeartbeatFrequency, getHttpClientKey, getInjectFileUploadFailure, getInjectWaitInPut, getMemoryLimitForTesting, getMetadataRequestUseConnectionCtx, getMetadataRequestUseSessionDatabase, getOCSPMode, getOtherParameter, getPreparedStatementLogging, getQueryContext, getQueryTimeout, getRole, getSchema, getServerUrl, getServiceName, getSessionId, getSessionPropertyByKey, getSfConnectionHandler, getSqlWarnings, getStoreTemporaryCredential, getTimestampMappedType, getTreatNTZAsUTC, getUrl, getUser, getUseRegionalS3EndpointsForPresignedURL, getUseSessionTimezone, getValidateDefaultParameters, getWarehouse, isClientTelemetryEnabled, isConservativeMemoryUsageEnabled, isJdbcTreatDecimalAsInt, isResultColumnCaseInsensitive, isSfSQLMode, isStringQuoted, setArrayBindStage, setArrayBindStageThreshold, setAutoCommit, setClientMemoryLimit, setClientPrefetchThreads, setClientResultChunkSize, setClientTelemetryEnabled, setConservativeMemoryAdjustStep, setDatabase, setDatabaseMajorVersion, setDatabaseMinorVersion, setDatabaseVersion, setEnableConservativeMemoryUsage, setEnableHeartbeat, setFormatDateWithTimezone, setHeartbeatFrequency, setInjectedDelay, setInjectFileUploadFailure, setJdbcTreatDecimalAsInt, setMemoryLimitForTesting, setMetadataRequestUseConnectionCtx, setMetadataRequestUseSessionDatabase, setOtherParameter, setPreparedStatementLogging, setQueryContext, setResultColumnCaseInsensitive, setRole, setSchema, setServiceName, setSessionId, setSessionPropertyByKey, setSfSQLMode, setStoreTemporaryCredential, setTimestampMappedType, setTreatNTZAsUTC, setUseRegionalS3EndpointsForPresignedURL, setUseSessionTimezone, setValidateDefaultParameters, setWarehouse, unsetInvalidProxyHostAndPortpublic static final String SF_QUERY_REQUEST_ID
public static final String SF_HEADER_AUTHORIZATION
public static final String SF_HEADER_SNOWFLAKE_AUTHTYPE
public static final String SF_HEADER_TOKEN_TAG
public SFSession()
public SFSession(DefaultSFConnectionHandler sfConnectionHandler)
public boolean isSafeToClose()
isSafeToClose in class SFBaseSessionpublic QueryStatus getQueryStatus(String queryID) throws SQLException
queryID - query ID of the query whose status is being investigatedSQLExceptionpublic void addSFSessionProperty(String propertyName, Object propertyValue) throws SFException
Make sure a property is not added more than once and the number of properties does not exceed limit.
propertyName - property namepropertyValue - property valueSFException - exception raised from Snowflake componentspublic boolean containProperty(String key)
public void open()
throws SFException,
SnowflakeSQLException
SFException - this is a runtime exceptionSnowflakeSQLException - exception raised from Snowflake componentspublic String getSessionToken()
public void close()
throws SFException,
SnowflakeSQLException
close in class SFBaseSessionSnowflakeSQLException - if failed to close the connectionSFException - if failed to close the connectionpublic void callHeartBeat(int timeout)
throws Exception,
SFException
callHeartBeat in class SFBaseSessiontimeout - the query timeoutException - if an error occursSFException - exception raised from Snowflakeprotected void startHeartbeatForThisSession()
protected void stopHeartbeatForThisSession()
protected void heartbeat()
throws SFException,
SQLException
SFException - exception raised from SnowflakeSQLException - exception raised from SQL generic layerspublic void raiseError(Throwable exc, String jobId, String requestId)
SFBaseSessionraiseError in class SFBaseSessionexc - The throwable exceptionjobId - jobId that failedrequestId - requestId that failedpublic int getInjectSocketTimeout()
public void setInjectSocketTimeout(int injectSocketTimeout)
public int getNetworkTimeoutInMilli()
getNetworkTimeoutInMilli in class SFBaseSessionpublic int getAuthTimeout()
getAuthTimeout in class SFBaseSessionpublic int getHttpClientSocketTimeout()
getHttpClientSocketTimeout in class SFBaseSessionpublic int getHttpClientConnectionTimeout()
getHttpClientConnectionTimeout in class SFBaseSessionpublic boolean isClosed()
public int getInjectClientPause()
public void setInjectClientPause(int injectClientPause)
protected int getAndIncrementSequenceId()
public boolean getEnableCombineDescribe()
getEnableCombineDescribe in class SFBaseSessionpublic void setEnableCombineDescribe(boolean enable)
setEnableCombineDescribe in class SFBaseSessionpublic Telemetry getTelemetryClient()
SFBaseSessiongetTelemetryClient in class SFBaseSessionpublic void closeTelemetryClient()
public String getIdToken()
public String getMfaToken()
public SnowflakeConnectString getSnowflakeConnectionString()
getSnowflakeConnectionString in class SFBaseSessionpublic void setSnowflakeConnectionString(SnowflakeConnectString connStr)
public List<DriverPropertyInfo> checkProperties()
SFBaseSessioncheckProperties in class SFBaseSessionpublic boolean isAsyncSession()
isAsyncSession in class SFBaseSessionCopyright © 2022. All rights reserved.