Package io.debezium.relational
Class RelationalDatabaseSchema
java.lang.Object
io.debezium.relational.RelationalDatabaseSchema
- All Implemented Interfaces:
DatabaseSchema<TableId>,AutoCloseable
- Direct Known Subclasses:
HistorizedRelationalDatabaseSchema
A
DatabaseSchema 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 ClassesModifier and TypeClassDescriptionprivate static classA map of schemas by table id. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Tables.ColumnNameFilterprivate final ColumnMappersprivate final Key.KeyMapperprivate static final org.slf4j.Loggerprivate final TableSchemaBuilderprivate final RelationalDatabaseSchema.SchemasByTableIdprivate final Tables.TableFilterprivate final Tablesprivate final TopicNamingStrategy<TableId>Fields inherited from interface io.debezium.schema.DatabaseSchema
NO_CAPTURED_DATA_COLLECTIONS_WARNING -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRelationalDatabaseSchema(RelationalDatabaseConnectorConfig config, TopicNamingStrategy<TableId> topicNamingStrategy, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, TableSchemaBuilder schemaBuilder, boolean tableIdCaseInsensitive, Key.KeyMapper customKeysMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidbuildAndRegisterSchema(Table table) Builds up the CDC event schema for the given table and stores it in this schema.protected voidvoidclose()protected Tables.TableFilterbooleanWhether this schema is historized (i.e.voidRefreshes the schema content with a table constructed externallyprotected voidrefreshSchema(TableId id) protected voidremoveSchema(TableId id) Get theSchema informationfor the table with the given identifier, if that table exists and is included by the filter configuration.Get theTablemeta-data for the table with the given identifier, if that table exists and is included by the filter configurationtableIds()Returns the set of table ids included in the current filter configuration.booleanIndicates whether or not table names are guaranteed to be fully present, regardless of whether or not a snapshot has been performed.protected Tablestables()
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
topicNamingStrategy
-
schemaBuilder
-
tableFilter
-
columnFilter
-
columnMappers
-
customKeysMapper
-
schemasByTableId
-
tables
-
-
Constructor Details
-
RelationalDatabaseSchema
protected RelationalDatabaseSchema(RelationalDatabaseConnectorConfig config, TopicNamingStrategy<TableId> topicNamingStrategy, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, TableSchemaBuilder schemaBuilder, boolean tableIdCaseInsensitive, Key.KeyMapper customKeysMapper)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
tableIds
Returns the set of table ids included in the current filter configuration. -
assureNonEmptySchema
public void assureNonEmptySchema()- Specified by:
assureNonEmptySchemain interfaceDatabaseSchema<TableId>
-
schemaFor
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
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
-
clearSchemas
protected void clearSchemas() -
buildAndRegisterSchema
Builds up the CDC event schema for the given table and stores it in this schema. -
removeSchema
-
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
Refreshes the schema content with a table constructed externally- Parameters:
table- constructed externally - typically from decoder metadata or an external signal
-
refreshSchema
-