Nifi PutSQL Timestamp/Datetime error cannot be converted error

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:24:07

问题


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:

The value of the sql.args.4.value is '', which cannot be converted to a timestamp at org.apache.nifi.processors.standard.PutSQL.setParameters(PutSQL.java:690) at

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!


回答1:


I found the answer to my question

sql.args.n.value -> ${sql.args.n.value:format("yyyy-MM-dd HH:mm:ss.SSS")}.



来源:https://stackoverflow.com/questions/45685703/nifi-putsql-timestamp-datetime-error-cannot-be-converted-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!