問題描述
我嘗試了建議使用UpdateAttribute"處理器來消除時間戳格式轉換錯誤的解決方案,即ConvertJSONtoSQL-> UpdateAttribute--> PutSQL
I tried the solution suggested to remove the timestamp format conversion error by using "UpdateAttribute" processor i.e. ConvertJSONtoSQL-> UpdateAttribute--> PutSQL
在 UpdateAttribute 中我使用了
In UpdateAttribute I used
Property Value
--------------- ------------------------
sql.args.4.value -> ${sql.args.4.original:format("yyyy-MM-dd HH:mm:ss")}
日志:
sql.args.4.value的值為'',無法轉換為時間戳在org.apache.nifi.processors.standard.PutSQL.setParameters(PutSQL.java:690)在
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
在不使用 UpdateAttribute 的情況下,我還嘗試了直接 ConvertJSONtoSQL-> PutSQL .日志在引用 'Aug 14 2017 10:17:00 EDT' 中顯示了與 datetime 值相同的錯誤,即當我們使用 UpdateAttribute 時,它??只是刪除該值并放置空引號,但錯誤未解決.
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.
注意: MySQL 表具有這些列的日期時間數據類型,不確定為什么嘗試轉換為時間戳會出錯.我還在本地主機上的源表和目標表中嘗試了 Timestamp 數據類型,但不走運!
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!
推薦答案
我找到了問題的答案
sql.args.n.value ->${sql.args.n.value:format("yyyy-MM-dd HH:mm:ss.SSS")}
.
這篇關于Nifi PutSQL 時間戳/日期時間錯誤無法轉換錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!