0
votes

Using Apache Nifi I want to create a batched list of values by extracting the primary key value from the flowfile content.

  1. GETHDFS
  2. SPLITCONTENT
  3. ROUTEONATTRIBUTE(just filters out filesizes less than 1.01 bytes due to code issue, don't mind this step)
  4. EVALUATEJSONPATH which produces the content: {"hist_idn":12345678,"filename":"Retry_Spark_HIST_IDN_12345678_I","reprocess_status":"N","reprocess_date":"2019-07-19 10:19:18"}
  5. From here I need help, my goal is to create a list of comma seperated hist_idn's then feed that into an executesql with the command: select * from History_table where hist_idn in (nifi generated comma seperated list)

Any help would be greatly appreciated.

1

1 Answers

1
votes

@chris fowler The next step you need is to evaluateJsonPath against the content from #4. Or adjust #4 to get $.hist_idn directly assuming it is a child of larger parent json object. Once hist_idn is an attribute you can then work downstream to combine. If you are getting multiple rows in #4, I suggest using a record reader to query the json for all of the hist_idn values that you want to send downstream.