Current state: Under Discussion

Discussion thread:


Pull request changes:


SetSchemaMetadata SMT doesn’t support transformation of the source schema namespace separately from the schema name transformation. When using Kafka Connect and Avro Converter with Schema Registry you may have to transform your source schema namespace independently from the schema name(s). Another use-case as mentioned in KAFKA-7883, when use JDBC connector with multiple tables in the source database you may have to preserve the original table names but only specify some non-empty namespace for them.

Public Interfaces

Adding schemaNamespace attribute to the class org.apache.kafka.connect.transforms.SetSchemaMetadata.

From the perspective of Kafka Connect SMT configuration it looks like adding of a new optional attribute "transforms.transformschema.schema.namespace":

"transforms" : "TransformSchema",
"transforms.TransformSchema.type" : "org.apache.kafka.connect.transforms.SetSchemaMetadata$Value",
"transforms.TransformSchema.schema.namespace" : "",
"" : "NewSchemaName",
"transforms.TransformSchema.schema.version" : 42

Proposed Changes

Adding of a new schema.namespace attribute to SetSchemaMetadata SMT letting developer to decide either to transform namespace only or transform both schema name and schema namespace by using either schema.namespace together with or just single attribute. In SetSchemaMetadata class we should concatenate values from schema.namespace and while we also should keep backward compatibility and leave all schema.namespace, and schema.version parameters optional.

Compatibility, Deprecation, and Migration Plan

The added "transforms.transformschema.schema.namespace" option's default value should be null, to be compatible with the old behavior.

Rejected Alternatives

Currently SetSchemaMetadata SMT provides a way to transform the namespace by specifying it directly in the parameter in concatenation with the target schema name like this:

"transforms" : "TransformSchema",
"transforms.TransformSchema.type" : "org.apache.kafka.connect.transforms.SetSchemaMetadata$Value",
  "" : ""

But with this way we’re unable to preserve the original schema name because the new schema name gets hardcoded in the parameter. To be able to transform namespace only and leave the schema name unchanged we have to provide a way to specify schema namespace separately from the schema name.

  • No labels