Drop

Description

Drop either a key or a value from a message and set it to null. The corresponding schema can also be set to null, modified to be made optional, checked to ensure that it is already optional, or retained as-is. Use the concrete transformation type designed for the record key (io.confluent.connect.transforms.Drop$Key) or value (io.confluent.connect.transforms.Drop$Value).

Installation

This transformation is developed by Confluent and does not ship by default with Apache Kafka or Confluent Platform. You can install this transformation via the Confluent Hub Client:

confluent-hub install confluentinc/connect-transforms:latest

Properties

Name Description Type Default Valid Values Importance
schema.behavior How to handle non-null schemas. If set to nullify, then the schema for the new record is null. If set to retain, the schema is used, regardless of whether it is optional. If set to validate, the schema is checked first, and if it is optional, it is used as-is; otherwise, an exception is thrown. If set to force_optional, the schema is overwritten to be optional, if it is not already. string nullify [nullify, retain, validate, force_optional] medium

Example

Below is a snippet of a configuration file for a standalone connector that demonstrates how to use and configure the Drop SMT.

transforms=dropKeyExample, dropValueAndForceOptionalSchemaExample

# Drop the key from the message, using the default behavior for schemas, which is to nullify them if
# they are not already null
transforms.dropKeyExample.type=io.confluent.connect.transforms.Drop$Key

# Drop the value from the message, and if the schema for the value isn't already optional,
# forcefully overwrite it to become optional.
transforms.dropValueAndForceOptionalSchemaExample.type=io.confluent.connect.transforms.Drop$Value
transforms.dropValueAndForceOptionalSchemaExample.schema.behavior=force_optional