Package io.debezium.schema
Class SchemaChangeEvent
java.lang.Object
io.debezium.schema.SchemaChangeEvent
Represents a structural change to a database schema.
- Author:
- Gunnar Morling
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumType describing the content of the event. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Stringprivate final booleanprivate final Stringprivate final org.apache.kafka.connect.data.Structprivate TableChangesprivate final SchemaChangeEvent.SchemaChangeEventType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSchemaChangeEvent(Map<String, ?> partition, Map<String, ?> offset, org.apache.kafka.connect.data.Struct source, String database, String schema, String ddl, Table table, SchemaChangeEvent.SchemaChangeEventType type, boolean isFromSnapshot, TableId previousTableId) privateSchemaChangeEvent(Map<String, ?> partition, Map<String, ?> offset, org.apache.kafka.connect.data.Struct source, String database, String schema, String ddl, Set<Table> tables, SchemaChangeEvent.SchemaChangeEventType type, boolean isFromSnapshot, Instant timestamp, TableId previousTableId) -
Method Summary
Modifier and TypeMethodDescriptiongetDdl()org.apache.kafka.connect.data.StructgetType()booleanstatic SchemaChangeEventof(SchemaChangeEvent.SchemaChangeEventType type, Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table, boolean isFromSnapshot) Create a schema change event for any event type that does not involve a table rename.static SchemaChangeEventofAlter(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table) Create a schema change event for aALTER TABLEevent.static SchemaChangeEventofCreate(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table, boolean isFromSnapshot) Create a schema change event for aCREATE TABLEstatement with DDL.static SchemaChangeEventofDatabase(Partition partition, OffsetContext offsetContext, String databaseName, String ddl, boolean isFromSnapshot) Create a schema change event for a database-specific DDL operation.static SchemaChangeEventofDrop(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table) Create a schema change event for aDROP TABLEevent.static SchemaChangeEventofRename(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table, TableId previousTableId) Create a schema change event for aALTER TABLE RENAMEevent.static SchemaChangeEventofSnapshotCreate(Partition partition, OffsetContext offsetContext, String databaseName, Table table) Create a schema change event for aCREATE TABLEstatement without DDL from snapshot phase.static SchemaChangeEventofTableChange(TableChanges.TableChange change, Map<String, ?> partition, Map<String, ?> offset, org.apache.kafka.connect.data.Struct source, String databaseName, String schemaName) Create a schema change event for aTableChanges.TableChange.private static SchemaChangeEvent.SchemaChangeEventTypetoString()
-
Field Details
-
database
-
schema
-
ddl
-
tables
-
type
-
partition
-
offset
-
source
private final org.apache.kafka.connect.data.Struct source -
isFromSnapshot
private final boolean isFromSnapshot -
tableChanges
-
-
Constructor Details
-
SchemaChangeEvent
-
SchemaChangeEvent
-
-
Method Details
-
getPartition
-
getOffset
-
getSource
public org.apache.kafka.connect.data.Struct getSource() -
getDatabase
-
getSchema
-
getDdl
-
getTables
-
getType
-
isFromSnapshot
public boolean isFromSnapshot() -
getTableChanges
-
toString
-
of
public static SchemaChangeEvent of(SchemaChangeEvent.SchemaChangeEventType type, Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table, boolean isFromSnapshot) Create a schema change event for any event type that does not involve a table rename.- Parameters:
type- the schema change event typepartition- the partitionoffsetContext- the offset contextdatabaseName- the database nameschemaName- the schema nameddl- the schema change DDL statementtable- the affected relational tableisFromSnapshot- flag indicating whether the change is from snapshot- Returns:
- the schema change event
-
ofTableChange
public static SchemaChangeEvent ofTableChange(TableChanges.TableChange change, Map<String, ?> partition, Map<String, ?> offset, org.apache.kafka.connect.data.Struct source, String databaseName, String schemaName) Create a schema change event for aTableChanges.TableChange.- Parameters:
change- the table change eventpartition- the partitionoffset- the offsetssource- the sourcedatabaseName- the database nameschemaName- the schema name- Returns:
- the schema change event
-
ofDatabase
public static SchemaChangeEvent ofDatabase(Partition partition, OffsetContext offsetContext, String databaseName, String ddl, boolean isFromSnapshot) Create a schema change event for a database-specific DDL operation.- Parameters:
partition- the partitionoffsetContext- the offset contextdatabaseName- the database nameddl- the schema change DDL statementisFromSnapshot- flag indicating whether the change is from snapshot- Returns:
- the schema change event
-
ofSnapshotCreate
public static SchemaChangeEvent ofSnapshotCreate(Partition partition, OffsetContext offsetContext, String databaseName, Table table) Create a schema change event for aCREATE TABLEstatement without DDL from snapshot phase.- Parameters:
partition- the partitionoffsetContext- the offset contextdatabaseName- the database nametable- the affected relational table- Returns:
- the schema change event
-
ofCreate
public static SchemaChangeEvent ofCreate(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table, boolean isFromSnapshot) Create a schema change event for aCREATE TABLEstatement with DDL.- Parameters:
partition- the partitionoffsetContext- the offset contextdatabaseName- the database nameschemaName- the schema nameddl- the schema change DDL statementtable- the affected relational tableisFromSnapshot- flag indicating whether the change is from snapshot- Returns:
- the schema change event
-
ofAlter
public static SchemaChangeEvent ofAlter(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table) Create a schema change event for aALTER TABLEevent.- Parameters:
partition- the partitionoffsetContext- the offset contextdatabaseName- the database nameschemaName- the schema nameddl- the schema change DDL statementtable- the affected relational table- Returns:
- the schema change event
-
ofRename
public static SchemaChangeEvent ofRename(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table, TableId previousTableId) Create a schema change event for aALTER TABLE RENAMEevent.- Parameters:
partition- the partitionoffsetContext- the offset contextdatabaseName- the database nameschemaName- the schema nameddl- the schema change DDL statementtable- the affected relational tablepreviousTableId- the old, previous relational table identifier- Returns:
- the schema change event
-
ofDrop
public static SchemaChangeEvent ofDrop(Partition partition, OffsetContext offsetContext, String databaseName, String schemaName, String ddl, Table table) Create a schema change event for aDROP TABLEevent.- Parameters:
partition- the partitionoffsetContext- the offset contextdatabaseName- the database nameschemaName- the schema nameddl- the schema change DDL statementtable- the affected relational table- Returns:
- the schema change event
-
toSchemaChangeEventType
private static SchemaChangeEvent.SchemaChangeEventType toSchemaChangeEventType(TableChanges.TableChangeType type)
-