4

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!

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Hem
  • 130
  • 2
  • 12

1 Answers1

3

I found the answer to my question

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

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94
Hem
  • 130
  • 2
  • 12
  • just wanted to know if the dataflow you used is convertjsontoSQL -> updateAttribute -> putsql – dimas Dec 12 '19 at 06:10
  • Thanks, I had the same problem putting Postgres in. I used queryrecord and concatenated ".000" to my date – Danieledu Aug 02 '20 at 03:11