Interface SnowflakeConnection
-
public interface SnowflakeConnectionThis interface defines Snowflake specific APIs for Connection
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResultSetcreateResultSet(String queryID)Create a new instance of a ResultSet object based off query ID.InputStreamdownloadStream(String stageName, String sourceFileName)Download a file from a Snowflake stage as a stream with required parameters only.InputStreamdownloadStream(String stageName, String sourceFileName, DownloadStreamConfig config)Download a file from a Snowflake stage as a stream with optional configuration.String[]getChildQueryIds(String queryID)Return an array of child query IDs for the given query ID.intgetDatabaseMajorVersion()Get the major version of the Snowflake database.intgetDatabaseMinorVersion()Get the minor version of the Snowflake database.StringgetDatabaseVersion()Get the full version string of the Snowflake database.QueryStatusgetQueryStatus(String queryID)Return the status of a query.StringgetSessionID()Return unique session ID from current session generated by making connectionvoiduploadStream(String stageName, String destFileName, InputStream inputStream)Upload data from a stream to a Snowflake stage with required parameters only.voiduploadStream(String stageName, String destFileName, InputStream inputStream, UploadStreamConfig config)Upload data from a stream to a Snowflake stage with optional configuration.
-
-
-
Method Detail
-
uploadStream
void uploadStream(String stageName, String destFileName, InputStream inputStream) throws SQLException
Upload data from a stream to a Snowflake stage with required parameters only.This is a convenience method that uses default options (compress data, no destination prefix). For advanced configuration, use
uploadStream(String, String, InputStream, UploadStreamConfig).The caller is responsible for closing the input stream after upload completes.
- Parameters:
stageName- the name of the stage (e.g., "@my_stage")destFileName- the destination file name on the stageinputStream- the input stream containing data to upload- Throws:
SQLException- if upload fails
-
uploadStream
void uploadStream(String stageName, String destFileName, InputStream inputStream, UploadStreamConfig config) throws SQLException
Upload data from a stream to a Snowflake stage with optional configuration.This method allows customization of upload behavior via
UploadStreamConfig, such as setting a destination prefix or controlling compression.The caller is responsible for closing the input stream after upload completes.
- Parameters:
stageName- the name of the stage (e.g., "@my_stage")destFileName- the destination file name on the stageinputStream- the input stream containing data to uploadconfig- optional configuration for upload behavior- Throws:
SQLException- if upload fails
-
downloadStream
InputStream downloadStream(String stageName, String sourceFileName) throws SQLException
Download a file from a Snowflake stage as a stream with required parameters only.This is a convenience method that uses default options (no decompression). For advanced configuration, use
downloadStream(String, String, DownloadStreamConfig).The caller is responsible for closing the returned input stream.
- Parameters:
stageName- the name of the stage (e.g., "@my_stage")sourceFileName- the path to the file within the stage- Returns:
- an input stream containing the file data
- Throws:
SQLException- if download fails
-
downloadStream
InputStream downloadStream(String stageName, String sourceFileName, DownloadStreamConfig config) throws SQLException
Download a file from a Snowflake stage as a stream with optional configuration.This method allows customization of download behavior via
DownloadStreamConfig, such as automatic decompression.The caller is responsible for closing the returned input stream.
- Parameters:
stageName- the name of the stage (e.g., "@my_stage")sourceFileName- the path to the file within the stageconfig- optional configuration for download behavior- Returns:
- an input stream containing the file data
- Throws:
SQLException- if download fails
-
getSessionID
String getSessionID() throws SQLException
Return unique session ID from current session generated by making connection- Returns:
- a unique alphanumeric value representing current session ID
- Throws:
SQLException- if an error occurs
-
getQueryStatus
QueryStatus getQueryStatus(String queryID) throws SQLException
Return the status of a query.- Parameters:
queryID- the query ID.- Returns:
- the status of the query.
- Throws:
SQLException- if an error occurs.
-
createResultSet
ResultSet createResultSet(String queryID) throws SQLException
Create a new instance of a ResultSet object based off query ID. ResultSet will contain results of corresponding query. Used when original ResultSet object is no longer available, such as when original connection has been closed.- Parameters:
queryID- the query ID- Returns:
- ResultSet based off the query ID
- Throws:
SQLException- if an error occurs
-
getChildQueryIds
String[] getChildQueryIds(String queryID) throws SQLException
Return an array of child query IDs for the given query ID.If the given query ID is for a multiple statements query, it returns an array of its child statements, otherwise, it returns an array to include the given query ID.
- Parameters:
queryID- The given query ID- Returns:
- An array of child query IDs
- Throws:
SQLException- If the query is running or the corresponding query is FAILED.
-
getDatabaseMajorVersion
int getDatabaseMajorVersion() throws SQLExceptionGet the major version of the Snowflake database.- Returns:
- database major version
- Throws:
SQLException- if an error occurs
-
getDatabaseMinorVersion
int getDatabaseMinorVersion() throws SQLExceptionGet the minor version of the Snowflake database.- Returns:
- database minor version
- Throws:
SQLException- if an error occurs
-
getDatabaseVersion
String getDatabaseVersion() throws SQLException
Get the full version string of the Snowflake database.- Returns:
- database version string
- Throws:
SQLException- if an error occurs
-
-