Interface SnowflakeConnection


  • public interface SnowflakeConnection
    This interface defines Snowflake specific APIs for Connection
    • 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 stage
        inputStream - 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 stage
        inputStream - the input stream containing data to upload
        config - 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 stage
        config - 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 SQLException
        Get the major version of the Snowflake database.
        Returns:
        database major version
        Throws:
        SQLException - if an error occurs
      • getDatabaseMinorVersion

        int getDatabaseMinorVersion()
                             throws SQLException
        Get 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