Skip to content

Commit

Permalink
DBZ-7167 Provide a public API from the connector implementations to r…
Browse files Browse the repository at this point in the history
…etrieve the list of matching collections or tables based on the different include-/exclude lists
  • Loading branch information
harveyyue committed Dec 12, 2023
1 parent 40d2afa commit a5ee40a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/debezium/connector/vitess/VitessConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.debezium.connector.common.RelationalBaseSourceConnector;
import io.debezium.connector.vitess.connection.VitessReplicationConnection;
import io.debezium.relational.RelationalDatabaseConnectorConfig;
import io.debezium.rest.model.DataCollection;
import io.debezium.util.Strings;
import io.grpc.StatusRuntimeException;
import io.vitess.proto.Query;
Expand Down Expand Up @@ -391,4 +392,14 @@ protected Map<String, ConfigValue> validateAllFields(Configuration config) {
}
return results;
}

@Override
public List<DataCollection> getMatchingCollections(Configuration configuration) {
VitessConnectorConfig vitessConnectorConfig = new VitessConnectorConfig(configuration);
String keyspace = vitessConnectorConfig.getKeyspace();
List<String> allTables = getKeyspaceTables(vitessConnectorConfig);
List<String> includedTables = getIncludedTables(keyspace,
vitessConnectorConfig.tableIncludeList(), allTables);
return includedTables.stream().map(table -> new DataCollection(keyspace, table)).collect(Collectors.toList());
}
}

0 comments on commit a5ee40a

Please sign in to comment.