Created on 06-23-2017 07:07 AM - edited 08-17-2019 08:24 PM
I try convert ingect json file into postgresql for that first i try to convert my json file into sql format by using ConvertJSONToSQL processor, after that I pass flow into replacetext processor and after that I make flow into putsql processor. In putsql processor I got issue "Due to org.postgresql.util.PSQLException: The column index is out of range: 1"
NIFI Flow
PutSQL Error:
PutSQL processor configuration
ReplaceText processor configuration
Replacement Value: "INSERT INTO public.detail (id,name, salary) VALUES (${id},${name},${salary})"
ConvertJSONToSQL processor configuration
Created 10-20-2017 03:59 PM
We are getting same error, please post if you found any solution for this error.
Created 10-21-2017 12:40 PM
Apparently this is the error form Postgres Driver, when I dig the reference for the error, got to know that when the mismatch of the column list or any issues with the sql is the possible root cause for the error.
however, when I look the sql I couldn't see the value for the Name is not quoted.( being the char column in SQL must be quoted).
any other column which is of char/date must be quoted in sql.
INSERT INTO public.detail (id,name, salary) VALUES (${id},'${name}',${salary})
On the other note, you could use convert json sql to --> put sql direct,
perhaps you may use json to Attribute --> Replace Text and then to --> putSQL. for the same thing if you wish to do it in different way.
Hope this helps !!
Created 10-21-2017 12:41 PM
and please ensure that, there are no columns in salary ( if it is defined as Decimal/integer in Database)