我正在使用confluent kafka connect jdbc源代码将mysql表中的记录推送到我的kafka主题,但似乎date列正在转换为epoch time。
这是我的配置:
{
"name": "mysql-source-test",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"tasks.max": "5",
"name": "mysql-source-test",
"connection.url":"jdbc:mysql://localhost:3306/brint?user=abc&password=xyz",
"topic.prefix":"mysql-source-test",
"poll.interval.ms":"100000000",
"query":"select updated_on from temp;",
"mode":"timestamp",
"batch.max.rows":"10"
}
}
Kafka主题中的输出:
{"updated_on":1531323874000}
我也尝试过在查询中使用像“select from \u unixtime(updated \u on)from temp”这样的命令,但是没有用。
有没有办法用yyyy-mm-dd hh:mm:ss格式推送给Kafka?
谢谢。
1条答案
按热度按时间yiytaume1#
我找不到任何办法来做这件事。
所以我更改了查询。
查询:
select CAST(date_format(updated_on, \"%b %d, %Y %r\") as CHAR(50)) from temp;
这就成功了。