Vitess Replace Field Value
The ReplaceFieldValue SMT replaces the value of a specified field from the event record.
When the connector is configured to provide transaction metadata, use this SMT to redact the transaction.id field to avoid storing a duplicate entry of the VGTID, or use for both transaction.id and source.vgtid to avoid storing any large VGTIDs.
This transformation is designed for use only with the Debezium connector for Vitess.
The SMT uses the field_names configuration option to specify a comma-separated list of paths that identify the fields that will have their values replaced.
The SMT uses the field_value configuration option to specify the replacement value for the fields. Defaults to the empty string.
The SMT replaces the value of each field that you specify. The following example shows how to add the SMT to the connector configuration so that it replaces the values of specific fields from the change event records that the connector emits.
Example: Configuring the ReplaceFieldValue SMT
"connector.class": "io.debezium.connector.vitess.VitessConnector",
...
"transforms": "replaceFieldValue",
"transforms.replaceFieldValue.type": "io.debezium.connector.vitess.transforms.ReplaceFieldValue",
"transforms.replaceFieldValue.field_names": "transaction.id",
...
The following example shows the value of a change event record before and after the transformation is applied.
ReplaceFieldValue SMT- Value before the SMT processes the record
-
{ "before": {...} "after": {...} "source": {...} "transaction": { "id": "[{\"keyspace\":\"test_unsharded_keyspace\",\"shard\":\"0\",\"gtid\":\"MySQL56/e03ece6c-4c04-11ec-8e20-0242ac110004:1-68\"}]", "total_order": 1, "data_collection_order": 1 } } - Value after the SMT processes the record
-
{ "before": {...} "after": {...} "source": {...} "transaction": { "id": "", "total_order": 1, "data_collection_order": 1 } }
Configuration options for the ReplaceFieldValue SMT
The following table lists the configuration options that you can use with the ReplaceFieldValue SMT.
Property |
Description |
Type |
Default |
Valid Values |
Importance |
A comma-separated list that specifies the paths of the fields to replace values for the event record, for example, |
List |
No default value |
Non-empty list |
High |
|
The value that each replace field is set to, for example. |
List |
"" (Empty string) |
String value |
Medium |