Support Questions

Find answers, ask questions, and share your expertise

Facing ERROR: invalid input syntx for integer:"" while processing NiFI flow file

avatar
Explorer

Hello guys,
I am extracting attributes from the flow file and putting it to the PostgreSQL.
2017-04-27 09:15:04.794761 10.69.1.138 -> 10.69.1.100 <4>Apr 27 03:44:58 kernel: [ 542.579606] TS|242268|00:14:5a:03:29:72|RSSI_BCN|56

2017-04-27 09:47:59.351047 10.69.1.138 -> 10.69.1.100 <4>Apr 27 04:17:43 kernel: [ 2517.159922] TS|2216852|00:14:5a:03:23:01|RSSI_BCN|53

  • I am trying to extract integer value 56,53... end of the line and put it to the column<col> of PostgreSQL table<tab> where the <col>datatype is integer. 
  • I used GetFile->SplitText->ExtractText ->putSQL in my process flow.
  • I used (\d*)\z regular expression in ExtractText processor and its seems working well for extracting the value 56.  But after a certain time the putSQL processor shows error ERROR: invalid input syntx for integer:"".
  • If I change the datatype from integer -> text in the <col> of my PostgreSQL table then I don't face this problem but I need to store the data in integer.
  • So can anyone please help me on finding the root cause of it, or what can I do to resolve it?

 

1 ACCEPTED SOLUTION

avatar
Explorer

Hello all,

The problem has been resolved.

  • First, I ingested the all the attributes as a text in the PostgreSQL table.
  • Then converted the text data to integer type with flowing command.
    ALTER TABLE public."tab"
    ALTER COLUMN col type int using nullif(col,'')::int
    Hope this will be helpful for others.

View solution in original post

1 REPLY 1

avatar
Explorer

Hello all,

The problem has been resolved.

  • First, I ingested the all the attributes as a text in the PostgreSQL table.
  • Then converted the text data to integer type with flowing command.
    ALTER TABLE public."tab"
    ALTER COLUMN col type int using nullif(col,'')::int
    Hope this will be helpful for others.