kafka smt用于iso utc日期时间格式的日期时间转换

ndasle7k  于 2021-06-06  发布在  Kafka
关注(0)|答案(1)|浏览(445)

是否可以转换类型为的列 datetime 在mysql中,是否可以在源连接器中转换为utc iso datetime格式?
输入详细信息
列名:modified\u dtmstamp
样本值:2018-08-03 16:37:20

... 
"transforms.TimestampConverter.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
        "transforms.TimestampConverter.field": "Modified_dtmStamp",
        "transforms.TimestampConverter.format": "ISO_INSTANT",
        "transforms.TimestampConverter.target.type": "Timestamp"

实现了引用https://docs.confluent.io/current/connect/transforms/timestampconverter.html.
错误:

"trace": "org.apache.kafka.common.config.ConfigException: Invalid value java.lang.IllegalArgumentException: Illegal pattern character 'I' for configuration TimestampConverter requires a SimpleDateFormat-compatible pattern for string timestamps: ISO_INSTANT\n\tat org.apache.kafka.connect.transforms.TimestampConverter.configure(TimestampConverter.java:263)\n\tat org.apache.kafka.connect.runtime.ConnectorConfig.transformations(ConnectorConfig.java:257)\n\tat ........
------------------------------------------------------------------------

更改 formatyyyy-MM-dd 在上面的示例中,连接器代码段的工作方式与示例中给出的相同。
但是,请特别查找utc iso格式。isoèu instant会起作用,但在这种情况下不起作用。

bn31dyow

bn31dyow1#

ISO_INSTANT 不是SimpleDataFormat字符串格式,而是其中的静态字段 java.time.* api,连接不使用
您必须显式地写出“yyyy-mm-dd hh:mm:ss”的完整值

相关问题