问题描述
我尝试了使用"UpdateAttribute"处理器来消除时间戳格式转换错误的建议解决方案,即ConvertJSONtoSQL-> UpdateAttribute-> PutSQL
在我使用的UpdateAttribute中
Property Value
--------------- ------------------------
sql.args.4.value -> ${sql.args.4.original:format("yyyy-MM-dd HH:mm:ss")}
日志:
在不使用UpdateAttribute的情况下,我也尝试了直接ConvertJSONtoSQL-> PutSQL.日志在报价'Aug 14 2017 10:17:00 EDT'中显示了与datetime值相同的错误,即当我们使用UpdateAttribute时,它只是删除了该值并将空引号括起来,但该错误未得到解决.
注意:MySQL表具有这些列的datetime数据类型,不确定通过尝试转换为TimeStamp导致错误的原因.我还在本地主机上的源表和目标表中尝试过Timestamp数据类型,不走运!
我找到了问题的答案
sql.args.n.value -> ${sql.args.n.value:format("yyyy-MM-dd HH:mm:ss.SSS")}
.
I tried the solution suggested to remove the timestamp format conversion error by using "UpdateAttribute" processor i.e.ConvertJSONtoSQL-> UpdateAttribute--> PutSQL
In UpdateAttribute I used
Property Value
--------------- ------------------------
sql.args.4.value -> ${sql.args.4.original:format("yyyy-MM-dd HH:mm:ss")}
Log:
Without the use of UpdateAttribute I also tried direct ConvertJSONtoSQL-> PutSQL . Log showed the same error with datetime value in quote 'Aug 14 2017 10:17:00 EDT' i.e. when we use UpdateAttribute, it just removes the value and put empty quotes but the error is not resolved.
Note: MySQL table has datetime datatype for those columns not sure why it errors out by trying to convert to TimeStamp. I also tried Timestamp datatype in source and target table on localhost, no luck!
I found the answer to my question
sql.args.n.value -> ${sql.args.n.value:format("yyyy-MM-dd HH:mm:ss.SSS")}
.
这篇关于Nifi PutSQL时间戳/日期时间错误无法转换错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!