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
Modifier and TypeClassDescriptionprivate static class
A map of schemas by table id. -
Field Summary
Modifier and TypeFieldDescriptionprivate final Tables.ColumnNameFilter
private final ColumnMappers
private final Key.KeyMapper
private static final org.slf4j.Logger
private final TableSchemaBuilder
private final RelationalDatabaseSchema.SchemasByTableId
private final Tables.TableFilter
private final Tables
private final TopicNamingStrategy<TableId>
Fields inherited from interface io.debezium.schema.DatabaseSchema
NO_CAPTURED_DATA_COLLECTIONS_WARNING
-
Constructor Summary
ModifierConstructorDescriptionprotected
RelationalDatabaseSchema
(RelationalDatabaseConnectorConfig config, TopicNamingStrategy<TableId> topicNamingStrategy, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, TableSchemaBuilder schemaBuilder, boolean tableIdCaseInsensitive, Key.KeyMapper customKeysMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
buildAndRegisterSchema
(Table table) Builds up the CDC event schema for the given table and stores it in this schema.protected void
void
close()
protected Tables.TableFilter
boolean
Whether this schema is historized (i.e.void
Refreshes the schema content with a table constructed externallyprotected void
refreshSchema
(TableId id) protected void
removeSchema
(TableId id) Get theSchema information
for the table with the given identifier, if that table exists and is included by the filter configuration.Get theTable
meta-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.boolean
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 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:
close
in interfaceAutoCloseable
-
tableIds
Returns the set of table ids included in the current filter configuration. -
assureNonEmptySchema
public void assureNonEmptySchema()- Specified by:
assureNonEmptySchema
in interfaceDatabaseSchema<TableId>
-
schemaFor
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
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
-
isHistorized
public boolean isHistorized()Description copied from interface:DatabaseSchema
Whether this schema is historized (i.e. a history of all schema changes is kept which is recovered upon connector restart) or not.- Specified by:
isHistorized
in 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: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
Refreshes the schema content with a table constructed externally- Parameters:
table
- constructed externally - typically from decoder metadata or an external signal
-
refreshSchema
-