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, sqlWarnings
Constructor and Description |
---|
SFSession() |
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
|
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() |
String |
getArrayBindStage() |
boolean |
getEnableCombineDescribe() |
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 |
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 |
setArrayBindStage(String arrayBindStage) |
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, getArrayBindStageThreshold, getAutoCommit, getClientInfo, getClientInfo, getClientMemoryLimit, getClientPrefetchThreads, getClientResultChunkSize, getConnectionPropertiesMap, getConservativeMemoryAdjustStep, getDatabase, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseVersion, getEnableHeartbeat, getFormatDateWithTimezone, getHeartbeatFrequency, getHttpClientKey, getInjectFileUploadFailure, getInjectWaitInPut, getMetadataRequestUseConnectionCtx, getMetadataRequestUseSessionDatabase, getOCSPMode, getOtherParameter, getPreparedStatementLogging, getQueryTimeout, getRole, getSchema, getServerUrl, getServiceName, getSessionId, getSessionPropertyByKey, getSqlWarnings, getStoreTemporaryCredential, getTimestampMappedType, getTreatNTZAsUTC, getUrl, getUser, getUseRegionalS3EndpointsForPresignedURL, getUseSessionTimezone, getValidateDefaultParameters, getWarehouse, isClientTelemetryEnabled, isConservativeMemoryUsageEnabled, isJdbcTreatDecimalAsInt, isResultColumnCaseInsensitive, isSfSQLMode, isStringQuoted, setArrayBindStageThreshold, setAutoCommit, setClientMemoryLimit, setClientPrefetchThreads, setClientResultChunkSize, setClientTelemetryEnabled, setConservativeMemoryAdjustStep, setDatabase, setDatabaseMajorVersion, setDatabaseMinorVersion, setDatabaseVersion, setEnableConservativeMemoryUsage, setEnableHeartbeat, setFormatDateWithTimezone, setHeartbeatFrequency, setInjectedDelay, setInjectFileUploadFailure, setJdbcTreatDecimalAsInt, setMetadataRequestUseConnectionCtx, setMetadataRequestUseSessionDatabase, setOtherParameter, setPreparedStatementLogging, setResultColumnCaseInsensitive, setRole, setSchema, setServiceName, setSessionId, setSessionPropertyByKey, setSfSQLMode, setStoreTemporaryCredential, setTimestampMappedType, setTreatNTZAsUTC, setUseRegionalS3EndpointsForPresignedURL, setUseSessionTimezone, setValidateDefaultParameters, setWarehouse
public 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 boolean isSafeToClose()
isSafeToClose
in class SFBaseSession
public QueryStatus getQueryStatus(String queryID) throws SQLException
queryID
- query ID of the query whose status is being investigatedSQLException
public 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 SFBaseSession
SnowflakeSQLException
- if failed to close the connectionSFException
- if failed to close the connectionprotected 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)
SFBaseSession
raiseError
in class SFBaseSession
exc
- The throwable exceptionjobId
- jobId that failedrequestId
- requestId that failedpublic int getInjectSocketTimeout()
public void setInjectSocketTimeout(int injectSocketTimeout)
public int getNetworkTimeoutInMilli()
getNetworkTimeoutInMilli
in class SFBaseSession
public boolean isClosed()
public int getInjectClientPause()
public void setInjectClientPause(int injectClientPause)
protected int getAndIncrementSequenceId()
public boolean getEnableCombineDescribe()
getEnableCombineDescribe
in class SFBaseSession
public void setEnableCombineDescribe(boolean enable)
setEnableCombineDescribe
in class SFBaseSession
public Telemetry getTelemetryClient()
SFBaseSession
getTelemetryClient
in class SFBaseSession
public void closeTelemetryClient()
public String getArrayBindStage()
public void setArrayBindStage(String arrayBindStage)
public String getIdToken()
public String getMfaToken()
public SnowflakeConnectString getSnowflakeConnectionString()
getSnowflakeConnectionString
in class SFBaseSession
public void setSnowflakeConnectionString(SnowflakeConnectString connStr)
public List<DriverPropertyInfo> checkProperties()
SFBaseSession
checkProperties
in class SFBaseSession
Copyright © 2021. All rights reserved.