Class DatabricksUCVolumeClient

    • Constructor Detail

      • DatabricksUCVolumeClient

        public DatabricksUCVolumeClient​(Connection connection)
    • Method Detail

      • prefixExists

        public boolean prefixExists​(String catalog,
                                    String schema,
                                    String volume,
                                    String prefix,
                                    boolean caseSensitive)
                             throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        prefixExists(): Determines if a specific prefix (folder-like structure) exists in the UC Volume The prefix that we are looking for must be a part of the file name.
        Specified by:
        prefixExists in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        prefix - the prefix to check for existence along with the relative path from the volume as the root directory
        caseSensitive - a boolean indicating whether the check should be case-sensitive or not
        Returns:
        a boolean indicating whether the prefix exists or not
        Throws:
        SQLException
      • objectExists

        public boolean objectExists​(String catalog,
                                    String schema,
                                    String volume,
                                    String objectPath,
                                    boolean caseSensitive)
                             throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        objectExists(): Determines if a specific object (file) exists in the UC Volume The object that we are looking for must match the file name exactly
        Specified by:
        objectExists in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        objectPath - the path of the object (file) from the volume as the root directory to check for existence within the volume (inside any sub-folder)
        caseSensitive - a boolean indicating whether the check should be case-sensitive or not
        Returns:
        a boolean indicating whether the object exists or not
        Throws:
        SQLException
      • volumeExists

        public boolean volumeExists​(String catalog,
                                    String schema,
                                    String volumeName,
                                    boolean caseSensitive)
                             throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        volumeExists(): Determines if a specific volume exists in the given catalog and schema. The volume that we are looking for must match the volume name exactly.
        Specified by:
        volumeExists in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volumeName - the name of the volume to check for existence
        caseSensitive - a boolean indicating whether the check should be case-sensitive or not
        Returns:
        a boolean indicating whether the volume exists or not
        Throws:
        SQLException
      • listObjects

        public List<String> listObjects​(String catalog,
                                        String schema,
                                        String volume,
                                        String prefix,
                                        boolean caseSensitive)
                                 throws SQLException
        This functions lists all the files that fall under the specified prefix within the target folder in the specified volume. The prefix is checked with the word after the last / in the input Ex - 1. foo/bar will list all the files within foo folder having bar as prefix | 2. foo/bar/f will list all the files within the bar folder with prefix f | 3. foo/bar/ will list all the files within the bar folder with all prefix
        Specified by:
        listObjects in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        prefix - the prefix of the filenames to list. This includes the relative path from the volume as the root directory
        caseSensitive - a boolean indicating whether the check should be case-sensitive or not
        Returns:
        List a list of strings indicating the filenames that start with the specified prefix
        Throws:
        SQLException
      • getObject

        public boolean getObject​(String catalog,
                                 String schema,
                                 String volume,
                                 String objectPath,
                                 String localPath)
                          throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        getObject(): Retrieves an object (file) from the UC Volume and stores it in the local path
        Specified by:
        getObject in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        objectPath - the path of the object (file) from the volume as the root directory
        localPath - the local path where the retrieved data is to be stored
        Returns:
        a boolean value indicating status of the GET operation
        Throws:
        SQLException
      • getObject

        public org.apache.http.entity.InputStreamEntity getObject​(String catalog,
                                                                  String schema,
                                                                  String volume,
                                                                  String objectPath)
                                                           throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        getObject(): Retrieves an object as input stream from the UC Volume
        Specified by:
        getObject in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        objectPath - the path of the object (file) from the volume as the root directory
        Returns:
        an instance of input stream entity
        Throws:
        SQLException
      • putObject

        public boolean putObject​(String catalog,
                                 String schema,
                                 String volume,
                                 String objectPath,
                                 String localPath,
                                 boolean toOverwrite)
                          throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        putObject(): Upload data from a local path to a specified path within a UC Volume.
        Specified by:
        putObject in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        objectPath - the destination path where the object (file) is to be uploaded from the volume as the root directory
        localPath - the local path from where the data is to be uploaded
        toOverwrite - a boolean indicating whether to overwrite the object if it already exists
        Returns:
        a boolean value indicating status of the PUT operation
        Throws:
        SQLException
      • putObject

        public boolean putObject​(String catalog,
                                 String schema,
                                 String volume,
                                 String objectPath,
                                 InputStream inputStream,
                                 long contentLength,
                                 boolean toOverwrite)
                          throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        putObject(): Upload data from an input stream to a specified path within a UC Volume.
        Specified by:
        putObject in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        objectPath - the destination path where the object (file) is to be uploaded from the volume as the root directory
        inputStream - the input stream from where the data is to be uploaded
        contentLength - the length of the input stream
        toOverwrite - a boolean indicating whether to overwrite the object if it already exists
        Returns:
        a boolean value indicating status of the PUT operation
        Throws:
        SQLException
      • deleteObject

        public boolean deleteObject​(String catalog,
                                    String schema,
                                    String volume,
                                    String objectPath)
                             throws SQLException
        Description copied from interface: IDatabricksUCVolumeClient
        deleteObject(): Remove an object from a specified path within a UC Volume
        Specified by:
        deleteObject in interface IDatabricksUCVolumeClient
        Parameters:
        catalog - the catalog name of the cloud storage
        schema - the schema name of the cloud storage
        volume - the UC volume name of the cloud storage
        objectPath - the path of the object (file) from the volume as the root directory to delete
        Returns:
        a boolean value indicating status of the DELETE operation
        Throws:
        SQLException