Package io.debezium.relational
Class RelationalDatabaseSchema
- java.lang.Object
-
- io.debezium.relational.RelationalDatabaseSchema
-
- All Implemented Interfaces:
DatabaseSchema<TableId>
- Direct Known Subclasses:
HistorizedRelationalDatabaseSchema
public abstract class RelationalDatabaseSchema extends Object implements DatabaseSchema<TableId>
ADatabaseSchema
of a relational database such as Postgres. Provides information about the physical structure of the database (the "database schema") as well as the structure of corresponding CDC messages (the "event schema").- Author:
- Gunnar Morling
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RelationalDatabaseSchema.SchemasByTableId
A map of schemas by table id.
-
Field Summary
Fields Modifier and Type Field Description private Tables.ColumnNameFilter
columnFilter
private ColumnMappers
columnMappers
private Key.KeyMapper
customKeysMapper
private static org.slf4j.Logger
LOG
private TableSchemaBuilder
schemaBuilder
private String
schemaPrefix
private RelationalDatabaseSchema.SchemasByTableId
schemasByTableId
private Tables.TableFilter
tableFilter
private Tables
tables
private TopicSelector<TableId>
topicSelector
-
Fields inherited from interface io.debezium.schema.DatabaseSchema
NO_CAPTURED_DATA_COLLECTIONS_WARNING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RelationalDatabaseSchema(RelationalDatabaseConnectorConfig config, TopicSelector<TableId> topicSelector, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, TableSchemaBuilder schemaBuilder, boolean tableIdCaseInsensitive, Key.KeyMapper customKeysMapper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assureNonEmptySchema()
protected void
buildAndRegisterSchema(Table table)
Builds up the CDC event schema for the given table and stores it in this schema.protected void
clearSchemas()
void
close()
private String
getEnvelopeSchemaName(Table table)
private static String
getSchemaPrefix(String serverName)
protected Tables.TableFilter
getTableFilter()
void
refresh(Table table)
Refreshes the schema content with a table constructed externallyprotected void
refreshSchema(TableId id)
protected void
removeSchema(TableId id)
TableSchema
schemaFor(TableId id)
Get theSchema information
for the table with the given identifier, if that table exists and is included by the filter configuration.Table
tableFor(TableId id)
Get theTable
meta-data for the table with the given identifier, if that table exists and is included by the filter configurationSet<TableId>
tableIds()
Returns the set of table ids included in the current filter configuration.boolean
tableInformationComplete()
Indicates whether or not table names are guaranteed to be fully present, regardless of whether or not a snapshot has been performed.protected Tables
tables()
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
topicSelector
private final TopicSelector<TableId> topicSelector
-
schemaBuilder
private final TableSchemaBuilder schemaBuilder
-
tableFilter
private final Tables.TableFilter tableFilter
-
columnFilter
private final Tables.ColumnNameFilter columnFilter
-
columnMappers
private final ColumnMappers columnMappers
-
customKeysMapper
private final Key.KeyMapper customKeysMapper
-
schemaPrefix
private final String schemaPrefix
-
schemasByTableId
private final RelationalDatabaseSchema.SchemasByTableId schemasByTableId
-
tables
private final Tables tables
-
-
Constructor Detail
-
RelationalDatabaseSchema
protected RelationalDatabaseSchema(RelationalDatabaseConnectorConfig config, TopicSelector<TableId> topicSelector, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, TableSchemaBuilder schemaBuilder, boolean tableIdCaseInsensitive, Key.KeyMapper customKeysMapper)
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceDatabaseSchema<TableId>
-
tableIds
public Set<TableId> tableIds()
Returns the set of table ids included in the current filter configuration.
-
assureNonEmptySchema
public void assureNonEmptySchema()
- Specified by:
assureNonEmptySchema
in interfaceDatabaseSchema<TableId>
-
schemaFor
public TableSchema schemaFor(TableId id)
Get theSchema information
for the table with the given identifier, if that table exists and is included by the filter configuration.Note that the
Schema
will not contain any columns that have been filtered out.- Specified by:
schemaFor
in interfaceDatabaseSchema<TableId>
- Parameters:
id
- the table identifier; may be null- Returns:
- the schema information, or null if there is no table with the given identifier, if the identifier is null, or if the table has been excluded by the filters
-
tableFor
public Table tableFor(TableId id)
Get theTable
meta-data for the table with the given identifier, if that table exists and is included by the filter configuration- Parameters:
id
- the table identifier; may be null- Returns:
- the current table definition, or null if there is no table with the given identifier, if the identifier is null, or if the table has been excluded by the filters
-
tables
protected Tables tables()
-
clearSchemas
protected void clearSchemas()
-
buildAndRegisterSchema
protected void buildAndRegisterSchema(Table table)
Builds up the CDC event schema for the given table and stores it in this schema.
-
removeSchema
protected void removeSchema(TableId id)
-
getTableFilter
protected Tables.TableFilter getTableFilter()
-
tableInformationComplete
public boolean tableInformationComplete()
Description copied from interface:DatabaseSchema
Indicates whether or not table names are guaranteed to be fully present, regardless of whether or not a snapshot has been performed.- Specified by:
tableInformationComplete
in interfaceDatabaseSchema<TableId>
- Returns:
- boolean indicating if table names are present
-
refresh
public void refresh(Table table)
Refreshes the schema content with a table constructed externally- Parameters:
table
- constructed externally - typically from decoder metadata or an external signal
-
refreshSchema
protected void refreshSchema(TableId id)
-
-