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>
ADatabaseSchemaof 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 classRelationalDatabaseSchema.SchemasByTableIdA map of schemas by table id.
-
Field Summary
Fields Modifier and Type Field Description private Tables.ColumnNameFiltercolumnFilterprivate ColumnMapperscolumnMappersprivate Key.KeyMappercustomKeysMapperprivate static org.slf4j.LoggerLOGprivate TableSchemaBuilderschemaBuilderprivate StringschemaPrefixprivate RelationalDatabaseSchema.SchemasByTableIdschemasByTableIdprivate Tables.TableFiltertableFilterprivate Tablestablesprivate TopicSelector<TableId>topicSelector-
Fields inherited from interface io.debezium.schema.DatabaseSchema
NO_CAPTURED_DATA_COLLECTIONS_WARNING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRelationalDatabaseSchema(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 voidassureNonEmptySchema()protected voidbuildAndRegisterSchema(Table table)Builds up the CDC event schema for the given table and stores it in this schema.protected voidclearSchemas()voidclose()private StringgetEnvelopeSchemaName(Table table)private static StringgetSchemaPrefix(String serverName)protected Tables.TableFiltergetTableFilter()booleanisHistorized()Whether this schema is historized (i.e.voidrefresh(Table table)Refreshes the schema content with a table constructed externallyprotected voidrefreshSchema(TableId id)protected voidremoveSchema(TableId id)TableSchemaschemaFor(TableId id)Get theSchema informationfor the table with the given identifier, if that table exists and is included by the filter configuration.TabletableFor(TableId id)Get theTablemeta-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.booleantableInformationComplete()Indicates whether or not table names are guaranteed to be fully present, regardless of whether or not a snapshot has been performed.protected Tablestables()
-
-
-
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:
closein 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:
assureNonEmptySchemain interfaceDatabaseSchema<TableId>
-
schemaFor
public TableSchema schemaFor(TableId id)
Get theSchema informationfor the table with the given identifier, if that table exists and is included by the filter configuration.Note that the
Schemawill not contain any columns that have been filtered out.- Specified by:
schemaForin 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 theTablemeta-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
-
isHistorized
public boolean isHistorized()
Description copied from interface:DatabaseSchemaWhether this schema is historized (i.e. a history of all schema changes is kept which is recovered upon connector restart) or not.- Specified by:
isHistorizedin interfaceDatabaseSchema<TableId>
-
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:DatabaseSchemaIndicates whether or not table names are guaranteed to be fully present, regardless of whether or not a snapshot has been performed.- Specified by:
tableInformationCompletein 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)
-
-