SchemaChangeEventFilter

Schema change event filter configuration

To use the transformation, add the SchemaChangeEventFilter to the connector configuration, and specify the types of events that you want to remove. The following excerpt from a connector configuration shows how you would add the transformation to the connector and set it to remove DROP and TRUNCATE events from the DDL messages that the connector captures.

Schema change event filter configuration to remove DROP and TRUNCATE events

  1. transforms=filterTableDropAndTruncateEvent
  2. transforms.filterTableDropAndTruncateEvent.type=io.debezium.transforms.SchemaChangeEventFilter
  3. transforms.filterTableDropAndTruncateEvent.schema.change.event.exclude.list=DROP,TRUNCATE

For more information about configuring the transformation, see the schema change event filter configuration options.

Effect of applying the SchemaChangeEventFilter SMT

After you configure the SMT for a connector, whenever the connector captures schema change events that match the configured types, it resets the values for those events to null. The connector does not send events with the resulting null values to Kafka.

The following examples shows a schema change event record before it is processed by the SMT, followed by the output after the SMT filters the event.

Example 1. Schema change event record before it is processed by the SchemaChangeEventFilter transformation

  1. {
  2. "schema":{
  3. "type":"struct",
  4. "fields":[
  5. {
  6. "type":"int64",
  7. "optional":false,
  8. "field":"ts_ms"
  9. },
  10. {
  11. "type":"string",
  12. "optional":true,
  13. "field":"databaseName"
  14. },
  15. {
  16. "type":"string",
  17. "optional":true,
  18. "field":"schemaName"
  19. },
  20. {
  21. "type":"string",
  22. "optional":true,
  23. "field":"ddl"
  24. },
  25. {
  26. "type":"array",
  27. "items":{
  28. "type":"struct",
  29. "fields":[
  30. {
  31. "type":"string",
  32. "optional":false,
  33. "field":"type"
  34. },
  35. {
  36. "type":"string",
  37. "optional":false,
  38. "field":"id"
  39. }
  40. ],
  41. "optional":false,
  42. "name":"io.debezium.connector.schema.Change"
  43. },
  44. "optional":false,
  45. "field":"tableChanges"
  46. }
  47. ],
  48. "optional":false,
  49. "name":"filter.SchemaChangeValue"
  50. },
  51. "payload":{
  52. "ts_ms":1691035505397,
  53. "databaseName":"test",
  54. "schemaName":"test_schema",
  55. "ddl":"",
  56. "tableChanges":[
  57. {
  58. "type":"DROP",
  59. "id":"test.table"
  60. }
  61. ]
  62. }
  63. }

Based on the earlier configuration example, after the SMT processes the original schema change event, it resets the values for the DROP event to null, as shown in the following example:

Example 2. Schema change event record after processing by the SMT

  1. null

Configuration options

The following table lists the configuration options that you can use with the SchemaChangeEventFilter SMT.

Table 1. SchemaChangeEventFilter SMT configuration options

Property

Description

Type

Default

Valid values

A comma-separated list of schema change events to filter. Specify one or more of the following options:

  • CREATE

  • ALTER

  • DROP

  • TRUNCATE

  • DATABASE

String

No default value

Non-empty string