Class BaseTableMetadataReader

    • Field Detail

    • Constructor Detail

      • BaseTableMetadataReader

        public BaseTableMetadataReader​(Connection connection,
                                       ColumnMetadataReader columnMetadataReader,
                                       com.exasol.adapter.AdapterProperties properties,
                                       com.exasol.ExaMetadata exaMetadata,
                                       IdentifierConverter identifierConverter)
        Create a new instance of a TableMetadata.
        Parameters:
        connection - JDBC connection to remote data source
        columnMetadataReader - reader to be used to map the tables columns
        properties - user-defined adapter properties
        exaMetadata - metadata of the Exasol database
        identifierConverter - converter between source and Exasol identifiers
    • Method Detail

      • mapTables

        public List<com.exasol.adapter.metadata.TableMetadata> mapTables​(ResultSet remoteTables,
                                                                         List<String> filteredTables)
                                                                  throws SQLException
        Description copied from interface: TableMetadataReader
        Map a list of tables found in a JDBC result set to a list of TableMetadata.
        Specified by:
        mapTables in interface TableMetadataReader
        Parameters:
        remoteTables - result set containing the tables to be mapped
        filteredTables - list of tables name that is used to narrow down the mapping
        Returns:
        list of TableMetadata
        Throws:
        SQLException - if either mapping the table or its columns produces an SQL error
      • readTableName

        protected String readTableName​(ResultSet remoteTables)
                                throws SQLException
        Read the table name from a result set.
        Parameters:
        remoteTables - result set
        Returns:
        table name
        Throws:
        SQLException - if something goes wrong
      • mapTable

        protected com.exasol.adapter.metadata.TableMetadata mapTable​(ResultSet table,
                                                                     String tableName)
                                                              throws SQLException
        Read the table metadata from a result set.
        Parameters:
        table - result set
        tableName - table to read (name)
        Returns:
        table metadata
        Throws:
        SQLException - if reading fails
      • adjustIdentifierCase

        protected String adjustIdentifierCase​(String tableName)
        Convert the given identifier to the proper casing using the underlying IdentifierConverter.
        Parameters:
        tableName - Table name as provided by source
        Returns:
        Table name as required by the virtual schema host database
      • readComment

        protected String readComment​(ResultSet remoteTables)
                              throws SQLException
        Read the comment from a result set.
        Parameters:
        remoteTables - result set
        Returns:
        comment
        Throws:
        SQLException - if something goes wrong
      • tableHasColumns

        protected boolean tableHasColumns​(com.exasol.adapter.metadata.TableMetadata tableMetadata)
        Check if a table has columns.
        Parameters:
        tableMetadata - table metadata
        Returns:
        true if table has columns
      • isTableSupported

        protected boolean isTableSupported​(List<String> filteredTables,
                                           String tableName)
        Check if a table is supported.
        Parameters:
        filteredTables - filtered tables
        tableName - table to check
        Returns:
        true if table is supported
      • isTableIncludedByMapping

        public boolean isTableIncludedByMapping​(String tableName)
        Description copied from interface: TableMetadataReader
        Returns true if the metadata reader includes the table with the given name when the remote metadata gets mapped table name.
        Specified by:
        isTableIncludedByMapping in interface TableMetadataReader
        Parameters:
        tableName - name of the table
        Returns:
        true if the reader includes the the mapping, false if it is ignored
      • logSkippingUnsupportedTable

        protected void logSkippingUnsupportedTable​(String tableName)
        Log the skipping of an unsupported table.
        Parameters:
        tableName - table name
      • includeAllTables

        protected boolean includeAllTables​(List<String> filteredTables)
        Check if no tables are filtered.
        Parameters:
        filteredTables - filtered tables
        Returns:
        true if no filter is applied
      • logSkippingTableWithEmptyColumns

        protected void logSkippingTableWithEmptyColumns​(String tableName)
        Log the skipping of a table with no columns.
        Parameters:
        tableName - table name
      • isUnquotedIdentifier

        protected boolean isUnquotedIdentifier​(String identifier)
        Check if an identifier is unquoted.
        Parameters:
        identifier - identifier to check
        Returns:
        true if it's unquoted