jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/multithread/TableContextUtil.java
public Map<String, TableContext> listTablesForConfig(
      DatabaseVendor vendor,
      PushSource.Context context,
      List<Stage.ConfigIssue> issues,
      Connection connection,
      TableConfigBean tableConfigBean,
      TableJdbcELEvalContext tableJdbcELEvalContext,
      QuoteChar quoteChar
  ) throws SQLException, StageException {
    Map<String, TableContext> tableContextMap = new LinkedHashMap<>();
    Pattern tableExclusion =
        StringUtils.isEmpty(tableConfigBean.tableExclusionPattern)?
            null : Pattern.compile(tableConfigBean.tableExclusionPattern);
    Pattern schemaExclusion =
        StringUtils.isEmpty(tableConfigBean.schemaExclusionPattern)?
            null : Pattern.compile(tableConfigBean.schemaExclusionPattern);
    try (ResultSet rs = jdbcUtil.getTableAndViewMetadata(connection, tableConfigBean.schema, tableConfigBean.tablePattern)) {
      while (rs.next()) {
        String schemaName = rs.getString(TABLE_METADATA_TABLE_SCHEMA_CONSTANT);
        String tableName = rs.getString(TABLE_METADATA_TABLE_NAME_CONSTANT);
        if (
            (tableExclusion == null || !tableExclusion.matcher(tableName).matches()) &&
            (schemaExclusion == null || !schemaExclusion.matcher(schemaName).matches())
        ) {
          TableContext tableContext = createTableContext(
              vendor,
              context,
              issues,
              connection,
              schemaName,
              tableName,
              tableConfigBean,
              tableJdbcELEvalContext,
              quoteChar
          );
          if (tableContext != null) {
            tableContextMap.put(
                getQualifiedTableName(schemaName, tableName),
                tableContext
            );
          }
        }
      }
    }
    return tableContextMap;
  }
public Map<String, TableContext> listTablesForConfig(
      DatabaseVendor vendor,
      PushSource.Context context,
      List<Stage.ConfigIssue> issues,
      Connection connection,
      TableConfigBean tableConfigBean,
      TableJdbcELEvalContext tableJdbcELEvalContext,
      QuoteChar quoteChar
  ) throws SQLException, StageException {
    Map<String, TableContext> tableContextMap = new LinkedHashMap<>();
    Pattern tableExclusion =
        StringUtils.isEmpty(tableConfigBean.tableExclusionPattern)?
            null : Pattern.compile(tableConfigBean.tableExclusionPattern);
    Pattern schemaExclusion =
        StringUtils.isEmpty(tableConfigBean.schemaExclusionPattern)?
            null : Pattern.compile(tableConfigBean.schemaExclusionPattern);
    try (ResultSet rs = jdbcUtil.getTableAndViewMetadata(connection, tableConfigBean.schema, tableConfigBean.tablePattern)) {
      while (rs.next()) {
        String schemaName = rs.getString(TABLE_METADATA_TABLE_SCHEMA_CONSTANT);
        String tableName = rs.getString(TABLE_METADATA_TABLE_NAME_CONSTANT);
        if (
            (tableExclusion == null || !tableExclusion.matcher(tableName).matches()) &&
            (schemaExclusion == null || !schemaExclusion.matcher(schemaName).matches())
        ) {
          TableContext tableContext = createTableContext(
              vendor,
              context,
              issues,
              connection,
              schemaName,
              tableName,
              tableConfigBean,
              tableJdbcELEvalContext,
              quoteChar
          );
          if (tableContext != null) {
            tableContextMap.put(
                getQualifiedTableName(schemaName, tableName),
                tableContext
            );
          }
        }
      }
    }
    return tableContextMap;
  }
public Map < String , TableContext > listTablesForConfig ( DatabaseVendor vendor , PushSource . Context context , List < Stage . ConfigIssue > issues , Connection connection , TableConfigBean tableConfigBean , TableJdbcELEvalContext tableJdbcELEvalContext , QuoteChar quoteChar ) throws SQLException , StageException { Map < String , TableContext > tableContextMap = new LinkedHashMap <> ( ) ; Pattern tableExclusion = StringUtils . isEmpty ( tableConfigBean . tableExclusionPattern ) ? null : Pattern . compile ( tableConfigBean . tableExclusionPattern ) ; Pattern schemaExclusion = StringUtils . isEmpty ( tableConfigBean . schemaExclusionPattern ) ? null : Pattern . compile ( tableConfigBean . schemaExclusionPattern ) ; try ( ResultSet rs = jdbcUtil . getTableAndViewMetadata ( connection , tableConfigBean . schema , tableConfigBean . tablePattern ) ) { while ( rs . next ( ) ) { String schemaName = rs . getString ( TABLE_METADATA_TABLE_SCHEMA_CONSTANT ) ; String tableName = rs . getString ( TABLE_METADATA_TABLE_NAME_CONSTANT ) ; if ( ( tableExclusion == null || ! tableExclusion . matcher ( tableName ) . matches ( ) ) && ( schemaExclusion == null || ! schemaExclusion . matcher ( schemaName ) . matches ( ) ) ) { TableContext tableContext = createTableContext ( vendor , context , issues , connection , schemaName , tableName , tableConfigBean , tableJdbcELEvalContext , quoteChar ) ; if ( tableContext != null ) { tableContextMap . put ( getQualifiedTableName ( schemaName , tableName ) , tableContext ) ; } } } } return tableContextMap ; }
Lists all tables matching the {@link TableConfigBean} and creates a table context for each table.
@param connection JDBC connection
@param tableConfigBean {@link TableConfigBean}
@return Map of qualified table name to Table Context
@throws SQLException If list tables call fails
@throws StageException if partition configuration is not correct.
Lists all tables matching the {