Configuration to convert datetime datatype to string datatype

5 views
Skip to first unread message

Thu Hoài Đỗ

unread,
Oct 21, 2025, 4:21:46 AM (yesterday) Oct 21
to debezium
Hi Debezium Community,
We're using Kafka Strimzi in k8s with Debezium connectors using class = io.debezium.connector.mysql.MySqlConnector. The fields with datetime data type in the database are represented as unix timestamp with int64 data type in the Kafka message, but we want to convert them to a string. We add configs to connector.yaml:

    transforms: "convertToString"
    transforms.convertToString.type: "org.apache.kafka.connect.transforms.TimestampConverter$Value"
    transforms.convertToString.field: "created_at"
    transforms.convertToString.target.type: "string"
    transforms.convertToString.format: "yyyy-MM-dd HH:mm:ss.SSSSSS"
    transforms.convertToString.unix.precision: "microseconds"

But it doesn't work. Is there any solutions for this problem?

Chris Cranford

unread,
Oct 21, 2025, 4:25:36 AM (yesterday) Oct 21
to debe...@googlegroups.com
Hi -

You need to flatten [1] the event first if you want to use any of the standard Kafka transforms as they do not yet support referencing nested fields. Once the event is flattened, the transform will find the top-level `created_at` field inside the value. 

Thanks,
-cc

[1]: https://debezium.io/documentation/reference/3.3/transformations/event-flattening.html
--
You received this message because you are subscribed to the Google Groups "debezium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to debezium+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/debezium/7df82f70-f705-4ae8-b828-181461e603afn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages