Package net.snowflake.client.core
Class SFBaseSession
- java.lang.Object
-
- net.snowflake.client.core.SFBaseSession
-
- Direct Known Subclasses:
SFSession
public abstract class SFBaseSession extends Object
Snowflake session implementation base. The methods and fields contained within this class are setters and getters for shared session properties, i.e., those that may be set via connection time, in properties, as well as those that may be parsed from response headers from Snowflake (i.e., session parameters).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
-
-
Field Summary
Fields Modifier and Type Field Description protected int
heartbeatFrequency
static long
MEMORY_LIMIT_UNSET
protected List<SFException>
sqlWarnings
-
Constructor Summary
Constructors Modifier Constructor Description protected
SFBaseSession(SFConnectionHandler sfConnectionHandler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addProperty(String propertyName, Object propertyValue)
Adds a connection property to the connection-properties map.void
addProperty(SFSessionProperty sfSessionProperty, Object propertyValue)
Wrapper function for the other addProperty(String, Object) method that takes an SFSessionProperty instead of a String key.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 connectionString
getArrayBindStage()
int
getArrayBindStageThreshold()
abstract int
getAuthTimeout()
Deprecated.boolean
getAutoCommit()
autoCommit field specifies whether autocommit is enabled for the session.boolean
getClearBatchOnlyAfterSuccessfulExecution()
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<String,Object>
getCommonParameters()
Get common parametersMap<SFSessionProperty,Object>
getConnectionPropertiesMap()
Get the connection properties mapint
getConservativeMemoryAdjustStep()
String
getDatabase()
int
getDatabaseMajorVersion()
Get databse major versionint
getDatabaseMinorVersion()
Get the database minor versionString
getDatabaseVersion()
Get the database versionboolean
getDefaultFormatDateWithTimezone()
Get if using default date format with timezone.boolean
getDisableGcsDefaultCredentials()
boolean
getEnableCombineDescribe()
boolean
getEnableExactSchemaSearch()
boolean
getEnableHeartbeat()
Get if heartbeat is enabledboolean
getEnablePatternSearch()
boolean
getEnablePutGet()
boolean
getEnableReturnTimestampWithTimeZone()
boolean
getEnableWildcardsInShowMetadataCommands()
boolean
getFormatDateWithTimezone()
Get if date should be formatted with timezoneboolean
getGetDateUseNullTimezone()
int
getHeartbeatFrequency()
Retrieve session heartbeat frequency in secondsHttpClientSettingsKey
getHttpClientKey()
Get the http client keyString
getInjectFileUploadFailure()
Get inject file upload failure.int
getInjectWaitInPut()
Get inject wait inputboolean
getJdbcEnablePutGet()
abstract int
getMaxHttpRetries()
long
getMemoryLimitForTesting()
boolean
getMetadataRequestUseConnectionCtx()
Get if metadata request should use the connection ctxboolean
getMetadataRequestUseSessionDatabase()
Get whether the metadata request should use the session database.abstract int
getNetworkTimeoutInMilli()
Get network timeout in millisecondsOCSPMode
getOCSPMode()
Get OCSP modeObject
getOtherParameter(String key)
boolean
getPreparedStatementLogging()
Gets the value of CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS if one has been set.int
getQueryContextCacheSize()
abstract QueryContextDTO
getQueryContextDTO()
abstract QueryStatus
getQueryStatus(String queryID)
Deprecated.abstract QueryStatusV2
getQueryStatusV2(String queryID)
Integer
getQueryTimeout()
Get the query timeoutString
getRole()
String
getSchema()
String
getServerUrl()
Get the server urlString
getServiceName()
String
getSessionId()
Returns a unique id for this session.Object
getSessionPropertyByKey(String propertyName)
Fetch the value for a custom session property.SFConnectionHandler
getSfConnectionHandler()
Get the SFConnectionHandlerabstract SnowflakeConnectString
getSnowflakeConnectionString()
List<SFException>
getSqlWarnings()
JDBC API.boolean
getStoreTemporaryCredential()
abstract Telemetry
getTelemetryClient()
SnowflakeType
getTimestampMappedType()
Get timestamp mapped typeboolean
getTreatNTZAsUTC()
Get if NTZ should be treated as UTCboolean
getTreatTimeAsWallClockTime()
String
getUrl()
Get the server URLString
getUser()
Get the user nameboolean
getUseRegionalS3EndpointsForPresignedURL()
boolean
getUseSessionTimezone()
Get if session timezone should be used.boolean
getValidateDefaultParameters()
String
getWarehouse()
abstract boolean
isAsyncSession()
boolean
isClientTelemetryEnabled()
boolean
isConservativeMemoryUsageEnabled()
boolean
isJdbcArrowTreatDecimalAsInt()
boolean
isJdbcTreatDecimalAsInt()
Check if we want to treat decimal as int JDBC typesboolean
isOwnerOnlyStageFilePermissionsEnabled()
Get if owner-only stage file permissions feature is enabled.boolean
isResultColumnCaseInsensitive()
Get if result column is case-insensitiveabstract boolean
isSafeToClose()
Function that checks if the active session can be closed when the connection is closed.boolean
isSfSQLMode()
boolean
isStringQuoted()
Get whether columns strings are quoted.void
setArrayBindStage(String arrayBindStage)
void
setArrayBindStageThreshold(int arrayBindStageThreshold)
void
setAutoCommit(boolean autoCommit)
Sets value of autoCommit fieldvoid
setClientMemoryLimit(int clientMemoryLimit)
void
setClientPrefetchThreads(int clientPrefetchThreads)
void
setClientResultChunkSize(int clientResultChunkSize)
void
setClientTelemetryEnabled(boolean clientTelemetryEnabled)
void
setCommonParameters(Map<String,Object> parameters)
Set common parametersvoid
setConservativeMemoryAdjustStep(int conservativeMemoryAdjustStep)
void
setDatabase(String database)
void
setDatabaseMajorVersion(int databaseMajorVersion)
Set database major versionvoid
setDatabaseMinorVersion(int databaseMinorVersion)
Set the database minor versionvoid
setDatabaseVersion(String databaseVersion)
Set database versionvoid
setDefaultFormatDateWithTimezone(boolean defaultFormatDateWithTimezone)
Set if default date format with timezone should be usedvoid
setDisableGcsDefaultCredentials(boolean disableGcsDefaultCredentials)
void
setEnableCombineDescribe(boolean enableCombineDescribe)
void
setEnableConservativeMemoryUsage(boolean enableConservativeMemoryUsage)
void
setEnableHeartbeat(boolean enableHeartbeat)
Set if heartbeat is enabledvoid
setEnablePatternSearch(boolean enablePatternSearch)
boolean
setEnablePutGet(boolean enablePutGet)
void
setFormatDateWithTimezone(boolean formatDateWithTimezone)
Set if date should be formatted with timezonevoid
setGetDateUseNullTimezone(boolean getDateUseNullTimezone)
void
setHeartbeatFrequency(int frequency)
Set the heartbeat frequency in seconds.void
setInjectedDelay(int injectedDelay)
Set the injected delayvoid
setInjectFileUploadFailure(String fileToFail)
Set inject file upload failure Note: Should only be used in internal tests!void
setJdbcArrowTreatDecimalAsInt(boolean jdbcArrowTreatDecimalAsInt)
Set if decimal should be treated as int for arrow typesvoid
setJdbcEnablePutGet(boolean jdbcEnablePutGet)
void
setJdbcTreatDecimalAsInt(boolean jdbcTreatDecimalAsInt)
Set if decimal should be treated as int typevoid
setMemoryLimitForTesting(long memLimit)
void
setMetadataRequestUseConnectionCtx(boolean enabled)
Set to true if metadata request should use connection ctxvoid
setMetadataRequestUseSessionDatabase(boolean enabled)
Set to true if the metadata request should use the session database.void
setOtherParameter(String key, Object value)
void
setOwnerOnlyStageFilePermissionsEnabled(boolean booleanValue)
void
setPreparedStatementLogging(boolean value)
Set prepared statement loggingabstract void
setQueryContext(String queryContext)
Set query contextvoid
setQueryContextCacheSize(int queryContextCacheSize)
void
setResultColumnCaseInsensitive(boolean resultColumnCaseInsensitive)
Set if result column is case-insensitivevoid
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)
Set sfSQLModevoid
setStoreTemporaryCredential(boolean storeTemporaryCredential)
void
setTimestampMappedType(SnowflakeType timestampMappedType)
Set the timestamp mapped typevoid
setTreatNTZAsUTC(boolean treatNTZAsUTC)
Set whether NTZ should be treated as UTCvoid
setTreatTimeAsWallClockTime(boolean treatTimeAsWallClockTime)
void
setUseRegionalS3EndpointsForPresignedURL(boolean regionalS3Endpoint)
void
setUseSessionTimezone(boolean useSessionTimezone)
Set if session timezone should be used.void
setValidateDefaultParameters(boolean validateDefaultParameters)
void
setWarehouse(String warehouse)
void
unsetInvalidProxyHostAndPort()
Unset invalid proxy host and port values.
-
-
-
Field Detail
-
sqlWarnings
protected List<SFException> sqlWarnings
-
heartbeatFrequency
protected int heartbeatFrequency
-
MEMORY_LIMIT_UNSET
public static long MEMORY_LIMIT_UNSET
-
-
Constructor Detail
-
SFBaseSession
protected SFBaseSession(SFConnectionHandler sfConnectionHandler)
-
-
Method Detail
-
setMemoryLimitForTesting
public void setMemoryLimitForTesting(long memLimit)
-
getMemoryLimitForTesting
public long getMemoryLimitForTesting()
-
getClientInfo
public Properties getClientInfo()
Part of the JDBC API, where client applications may fetch a Map of Properties to set various attributes. This is not used internally by any driver component, but should be maintained by the Session object.- Returns:
- client info as Properties
-
setCommonParameters
public void setCommonParameters(Map<String,Object> parameters)
Set common parameters- Parameters:
parameters
- the parameters to set
-
getCommonParameters
public Map<String,Object> getCommonParameters()
Get common parameters- Returns:
- Map of common parameters
-
getClientInfo
public String getClientInfo(String name)
Gets the Property associated with the key 'name' in the ClientInfo map.- Parameters:
name
- The key from which to fetch the Property.- Returns:
- The ClientInfo entry property.
-
getSessionId
public String getSessionId()
Returns a unique id for this session.- Returns:
- unique id for session
-
setSessionId
public void setSessionId(String sessionId)
Sets the session-id attribute in this session.- Parameters:
sessionId
- The session id as a string.
-
isSfSQLMode
public boolean isSfSQLMode()
- Returns:
- true if session is in SQLMode
-
setSfSQLMode
public void setSfSQLMode(boolean sfSQLMode)
Set sfSQLMode- Parameters:
sfSQLMode
- boolean
-
getDatabaseVersion
public String getDatabaseVersion()
Get the database version- Returns:
- database version
-
setDatabaseVersion
public void setDatabaseVersion(String databaseVersion)
Set database version- Parameters:
databaseVersion
- the version to set
-
getDatabaseMajorVersion
public int getDatabaseMajorVersion()
Get databse major version- Returns:
- the database major version
-
setDatabaseMajorVersion
public void setDatabaseMajorVersion(int databaseMajorVersion)
Set database major version- Parameters:
databaseMajorVersion
- the database major version
-
getDatabaseMinorVersion
public int getDatabaseMinorVersion()
Get the database minor version- Returns:
- database minor version
-
setDatabaseMinorVersion
public void setDatabaseMinorVersion(int databaseMinorVersion)
Set the database minor version- Parameters:
databaseMinorVersion
- the minor version
-
getPreparedStatementLogging
public boolean getPreparedStatementLogging()
Gets the value of CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS if one has been set. False by default.- Returns:
- true if enabled
- See Also:
- CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS
-
setPreparedStatementLogging
public void setPreparedStatementLogging(boolean value)
Set prepared statement logging- Parameters:
value
- boolean- See Also:
getPreparedStatementLogging()
-
getInjectFileUploadFailure
public String getInjectFileUploadFailure()
Get inject file upload failure. Note: Should only be used in internal tests!- Returns:
- file to fail
-
setInjectFileUploadFailure
public void setInjectFileUploadFailure(String fileToFail)
Set inject file upload failure Note: Should only be used in internal tests!- Parameters:
fileToFail
- the file to fail
-
getTimestampMappedType
public SnowflakeType getTimestampMappedType()
Get timestamp mapped type- Returns:
SnowflakeType
- See Also:
- CLIENT_TIMESTAMP_TYPE_MAPPING
-
setTimestampMappedType
public void setTimestampMappedType(SnowflakeType timestampMappedType)
Set the timestamp mapped type- Parameters:
timestampMappedType
- SnowflakeType- See Also:
getTimestampMappedType()
-
isResultColumnCaseInsensitive
public boolean isResultColumnCaseInsensitive()
Get if result column is case-insensitive- Returns:
- true if result column is case-insensitive
- See Also:
setResultColumnCaseInsensitive(boolean)
-
setResultColumnCaseInsensitive
public void setResultColumnCaseInsensitive(boolean resultColumnCaseInsensitive)
Set if result column is case-insensitive- Parameters:
resultColumnCaseInsensitive
- boolean- See Also:
- CLIENT_RESULT_COLUMN_CASE_INSENSITIVE
-
isJdbcTreatDecimalAsInt
public boolean isJdbcTreatDecimalAsInt()
Check if we want to treat decimal as int JDBC types- Returns:
- true if decimal is treated as int
- See Also:
- JDBC_TREAT_DECIMAL_AS_INT
-
setJdbcTreatDecimalAsInt
public void setJdbcTreatDecimalAsInt(boolean jdbcTreatDecimalAsInt)
Set if decimal should be treated as int type- Parameters:
jdbcTreatDecimalAsInt
- boolean- See Also:
isJdbcTreatDecimalAsInt()
-
isJdbcArrowTreatDecimalAsInt
public boolean isJdbcArrowTreatDecimalAsInt()
- Returns:
- true if decimal should be treated as int for arrow types
-
setJdbcArrowTreatDecimalAsInt
public void setJdbcArrowTreatDecimalAsInt(boolean jdbcArrowTreatDecimalAsInt)
Set if decimal should be treated as int for arrow types- Parameters:
jdbcArrowTreatDecimalAsInt
- boolean
-
getServerUrl
public String getServerUrl()
Get the server url- Returns:
- the server url or null if it is not set
-
isStringQuoted
public boolean isStringQuoted()
Get whether columns strings are quoted.- Returns:
- value of 'stringsQuotedForColumnDef' connection property or false if not set.
-
addProperty
public void addProperty(SFSessionProperty sfSessionProperty, Object propertyValue) throws SFException
Wrapper function for the other addProperty(String, Object) method that takes an SFSessionProperty instead of a String key.- Parameters:
sfSessionProperty
- The property for which to set the value.propertyValue
- The value to set for the property.- Throws:
SFException
- If the value already exists for the given key (should only be set once), or if the value is invalid.
-
addProperty
public void addProperty(String propertyName, Object propertyValue) throws SFException
Adds a connection property to the connection-properties map. Connection properties are those that are defined in SFSessionProperty. They are set typically through instantiation of the Session.- Parameters:
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.- Throws:
SFException
- If the value already exists for the given key (should only be set once), or if the value is invalid.
-
getConnectionPropertiesMap
public Map<SFSessionProperty,Object> getConnectionPropertiesMap()
Get the connection properties map- Returns:
- the connection properties map
-
getHttpClientKey
public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException
Get the http client key- Returns:
- HttpClientSettingsKey
- Throws:
SnowflakeSQLException
- if exception encountered
-
unsetInvalidProxyHostAndPort
public void unsetInvalidProxyHostAndPort()
Unset invalid proxy host and port values.
-
getOCSPMode
public OCSPMode getOCSPMode() throws SnowflakeSQLException
Get OCSP mode- Returns:
OCSPMode
- Throws:
SnowflakeSQLException
-
getQueryTimeout
public Integer getQueryTimeout()
Get the query timeout- Returns:
- the query timeout value
-
getUser
public String getUser()
Get the user name- Returns:
- user name
-
getUrl
public String getUrl()
Get the server URL- Returns:
- the server URL
-
getInjectWaitInPut
public int getInjectWaitInPut()
Get inject wait input- Returns:
- the value of 'inject_wait_in_put' or 0 if not set
-
getMetadataRequestUseSessionDatabase
public boolean getMetadataRequestUseSessionDatabase()
Get whether the metadata request should use the session database.- Returns:
- true if it should use the session database
-
setMetadataRequestUseSessionDatabase
public void setMetadataRequestUseSessionDatabase(boolean enabled)
Set to true if the metadata request should use the session database.- Parameters:
enabled
- boolean
-
getMetadataRequestUseConnectionCtx
public boolean getMetadataRequestUseConnectionCtx()
Get if metadata request should use the connection ctx- Returns:
- true if it should use the connection ctx
-
setMetadataRequestUseConnectionCtx
public void setMetadataRequestUseConnectionCtx(boolean enabled)
Set to true if metadata request should use connection ctx- Parameters:
enabled
- boolean
-
setInjectedDelay
public void setInjectedDelay(int injectedDelay)
Set the injected delay- Parameters:
injectedDelay
- injectedDelay value
-
getTreatNTZAsUTC
public boolean getTreatNTZAsUTC()
Get if NTZ should be treated as UTC- Returns:
- true if NTZ should be treated as UTC
-
setTreatNTZAsUTC
public void setTreatNTZAsUTC(boolean treatNTZAsUTC)
Set whether NTZ should be treated as UTC- Parameters:
treatNTZAsUTC
- boolean
-
getEnableHeartbeat
public boolean getEnableHeartbeat()
Get if heartbeat is enabled- Returns:
- true if enabled
-
setEnableHeartbeat
public void setEnableHeartbeat(boolean enableHeartbeat)
Set if heartbeat is enabled- Parameters:
enableHeartbeat
- boolean
-
setHeartbeatFrequency
public void setHeartbeatFrequency(int frequency)
Set the heartbeat frequency in seconds. This is the frequency with which the session token is refreshed.- Parameters:
frequency
- heartbeat frequency in seconds
-
getHeartbeatFrequency
public int getHeartbeatFrequency()
Retrieve session heartbeat frequency in seconds- Returns:
- the heartbeat frequency in seconds
-
getAutoCommit
public boolean getAutoCommit()
autoCommit field specifies whether autocommit is enabled for the session. Autocommit determines whether a DML statement, when executed without an active transaction, is automatically committed after the statement successfully completes. default: true- Returns:
- a boolean value of autocommit field
- See Also:
- Transactions/Autocommit
-
setAutoCommit
public void setAutoCommit(boolean autoCommit)
Sets value of autoCommit field- Parameters:
autoCommit
- boolean- See Also:
getAutoCommit()
-
getFormatDateWithTimezone
public boolean getFormatDateWithTimezone()
Get if date should be formatted with timezone- Returns:
- true if date should be formatted with timezone
-
setFormatDateWithTimezone
public void setFormatDateWithTimezone(boolean formatDateWithTimezone)
Set if date should be formatted with timezone- Parameters:
formatDateWithTimezone
- boolean
-
getUseSessionTimezone
public boolean getUseSessionTimezone()
Get if session timezone should be used.- Returns:
- true if using session timezone
-
getDefaultFormatDateWithTimezone
public boolean getDefaultFormatDateWithTimezone()
Get if using default date format with timezone.- Returns:
- true if using default date format with timezone.
-
setUseSessionTimezone
public void setUseSessionTimezone(boolean useSessionTimezone)
Set if session timezone should be used.- Parameters:
useSessionTimezone
- boolean
-
setDefaultFormatDateWithTimezone
public void setDefaultFormatDateWithTimezone(boolean defaultFormatDateWithTimezone)
Set if default date format with timezone should be used- Parameters:
defaultFormatDateWithTimezone
- boolean
-
getGetDateUseNullTimezone
public boolean getGetDateUseNullTimezone()
-
setGetDateUseNullTimezone
public void setGetDateUseNullTimezone(boolean getDateUseNullTimezone)
-
getEnableCombineDescribe
public boolean getEnableCombineDescribe()
-
setEnableCombineDescribe
public void setEnableCombineDescribe(boolean enableCombineDescribe)
-
isClientTelemetryEnabled
public boolean isClientTelemetryEnabled()
-
setClientTelemetryEnabled
public void setClientTelemetryEnabled(boolean clientTelemetryEnabled)
-
getArrayBindStageThreshold
public int getArrayBindStageThreshold()
-
setArrayBindStageThreshold
public void setArrayBindStageThreshold(int arrayBindStageThreshold)
-
getStoreTemporaryCredential
public boolean getStoreTemporaryCredential()
-
setStoreTemporaryCredential
public void setStoreTemporaryCredential(boolean storeTemporaryCredential)
-
getServiceName
public String getServiceName()
-
setServiceName
public void setServiceName(String serviceName)
-
setEnableConservativeMemoryUsage
public void setEnableConservativeMemoryUsage(boolean enableConservativeMemoryUsage)
-
isConservativeMemoryUsageEnabled
public boolean isConservativeMemoryUsageEnabled()
-
getConservativeMemoryAdjustStep
public int getConservativeMemoryAdjustStep()
-
setConservativeMemoryAdjustStep
public void setConservativeMemoryAdjustStep(int conservativeMemoryAdjustStep)
-
getClientMemoryLimit
public int getClientMemoryLimit()
-
setClientMemoryLimit
public void setClientMemoryLimit(int clientMemoryLimit)
-
getQueryContextCacheSize
public int getQueryContextCacheSize()
-
setQueryContextCacheSize
public void setQueryContextCacheSize(int queryContextCacheSize)
-
getJdbcEnablePutGet
public boolean getJdbcEnablePutGet()
-
setJdbcEnablePutGet
public void setJdbcEnablePutGet(boolean jdbcEnablePutGet)
-
getEnablePutGet
public boolean getEnablePutGet()
-
setEnablePutGet
public boolean setEnablePutGet(boolean enablePutGet)
-
getEnablePatternSearch
public boolean getEnablePatternSearch()
-
setEnablePatternSearch
public void setEnablePatternSearch(boolean enablePatternSearch)
-
getEnableExactSchemaSearch
public boolean getEnableExactSchemaSearch()
-
getEnableWildcardsInShowMetadataCommands
public boolean getEnableWildcardsInShowMetadataCommands()
-
getDisableGcsDefaultCredentials
public boolean getDisableGcsDefaultCredentials()
-
setDisableGcsDefaultCredentials
public void setDisableGcsDefaultCredentials(boolean disableGcsDefaultCredentials)
-
getClientResultChunkSize
public int getClientResultChunkSize()
-
setClientResultChunkSize
public void setClientResultChunkSize(int clientResultChunkSize)
-
getClientPrefetchThreads
public int getClientPrefetchThreads()
-
setClientPrefetchThreads
public void setClientPrefetchThreads(int clientPrefetchThreads)
-
getValidateDefaultParameters
public boolean getValidateDefaultParameters()
-
setValidateDefaultParameters
public void setValidateDefaultParameters(boolean validateDefaultParameters)
-
getDatabase
public String getDatabase()
-
setDatabase
public void setDatabase(String database)
-
getSchema
public String getSchema()
-
setSchema
public void setSchema(String schema)
-
getRole
public String getRole()
-
setRole
public void setRole(String role)
-
getWarehouse
public String getWarehouse()
-
setWarehouse
public void setWarehouse(String warehouse)
-
setUseRegionalS3EndpointsForPresignedURL
public void setUseRegionalS3EndpointsForPresignedURL(boolean regionalS3Endpoint)
-
getUseRegionalS3EndpointsForPresignedURL
public boolean getUseRegionalS3EndpointsForPresignedURL()
-
getArrayBindStage
public String getArrayBindStage()
-
setArrayBindStage
public void setArrayBindStage(String arrayBindStage)
-
setSessionPropertyByKey
public void setSessionPropertyByKey(String propertyName, Object propertyValue)
Enables setting a value in the custom-properties map. This is used for properties that are implementation specific to the session, and not shared by the different implementations.- Parameters:
propertyName
- A string key for the property to set.propertyValue
- The property value.
-
getSessionPropertyByKey
public Object getSessionPropertyByKey(String propertyName)
Fetch the value for a custom session property.- Parameters:
propertyName
- The key of the session property to fetch.- Returns:
- session property value
-
isSafeToClose
public abstract boolean isSafeToClose()
Function that checks if the active session can be closed when the connection is closed. Called by SnowflakeConnectionV1.- Returns:
- true if the active session is safe to close.
-
getQueryStatus
@Deprecated public abstract QueryStatus getQueryStatus(String queryID) throws SQLException
Deprecated.- Parameters:
queryID
- query ID of the query whose status is being investigated- Returns:
- enum of type QueryStatus indicating the query's status
- Throws:
SQLException
- if error encountered
-
getQueryStatusV2
public abstract QueryStatusV2 getQueryStatusV2(String queryID) throws SQLException
- Parameters:
queryID
- query ID of the query whose status is being investigated- Returns:
- QueryStatusV2 indicating the query's status
- Throws:
SQLException
- if error encountered
-
checkProperties
public abstract List<DriverPropertyInfo> checkProperties()
Validates the connection properties used by this session, and returns a list of missing properties.- Returns:
- List of DriverPropertyInfo
-
close
public abstract void close() throws SFException, SnowflakeSQLException
Close the connection- Throws:
SnowflakeSQLException
- if failed to close the connectionSFException
- if failed to close the connection
-
getTelemetryClient
public abstract Telemetry getTelemetryClient()
- Returns:
- Returns the telemetry client, if supported, by this session. If not, should return a NoOpTelemetryClient.
-
callHeartBeat
public abstract void callHeartBeat(int timeout) throws Exception, SFException
Makes a heartbeat call to check for session validity.- Parameters:
timeout
- timeout value- Throws:
Exception
- if exception occursSFException
- if exception occurs
-
getSqlWarnings
public List<SFException> getSqlWarnings()
JDBC API. Returns a list of warnings generated since starting this session, or the last time it was cleared.- Returns:
- List of SFException's
-
clearSqlWarnings
public void clearSqlWarnings()
JDBC API. Clears the list of warnings generated since the start of the session, or the last time it was cleared.
-
getSfConnectionHandler
public SFConnectionHandler getSfConnectionHandler()
Get the SFConnectionHandler- Returns:
SFConnectionHandler
-
getNetworkTimeoutInMilli
public abstract int getNetworkTimeoutInMilli()
Get network timeout in milliseconds- Returns:
- network timeout in milliseconds
-
getAuthTimeout
@Deprecated public abstract int getAuthTimeout()
Deprecated.- Returns:
- auth timeout in seconds
-
getMaxHttpRetries
public abstract int getMaxHttpRetries()
- Returns:
- max http retries
-
getSnowflakeConnectionString
public abstract SnowflakeConnectString getSnowflakeConnectionString()
- Returns:
SnowflakeConnectString
-
isAsyncSession
public abstract boolean isAsyncSession()
- Returns:
- true if this is an async session
-
getQueryContextDTO
public abstract QueryContextDTO getQueryContextDTO()
- Returns:
- QueryContextDTO containing opaque information shared with the cloud service.
-
setQueryContext
public abstract void setQueryContext(String queryContext)
Set query context- Parameters:
queryContext
- the query context string
-
getEnableReturnTimestampWithTimeZone
public boolean getEnableReturnTimestampWithTimeZone()
- Returns:
- If true, JDBC will enable returning TIMESTAMP_WITH_TIMEZONE as column type, otherwise it will not. This function will always return true for JDBC client, so that the client JDBC will not have any behavior change. Stored proc JDBC will override this function to return the value of SP_JDBC_ENABLE_TIMESTAMP_WITH_TIMEZONE from server for backward compatibility.
-
getClearBatchOnlyAfterSuccessfulExecution
@SnowflakeJdbcInternalApi public boolean getClearBatchOnlyAfterSuccessfulExecution()
-
getTreatTimeAsWallClockTime
public boolean getTreatTimeAsWallClockTime()
-
setTreatTimeAsWallClockTime
public void setTreatTimeAsWallClockTime(boolean treatTimeAsWallClockTime)
-
isOwnerOnlyStageFilePermissionsEnabled
public boolean isOwnerOnlyStageFilePermissionsEnabled()
Get if owner-only stage file permissions feature is enabled.- Returns:
- true if owner-only stage file permissions feature is enabled
-
setOwnerOnlyStageFilePermissionsEnabled
public void setOwnerOnlyStageFilePermissionsEnabled(boolean booleanValue)
-
-