Re: Generalizing QueryRecord to changing inferred CSV headers

2023-04-23 Thread James McMahon
I did as you suggested Matt and attacked the problem with Groovy. Since I'm stronger at manipulating json than csv using Groovy, I first converted the incoming to json using a ConverRecord processor. I inferred the record schema from the header assumed in the incoming csv. (still tbd: how I will

Re: Generalizing QueryRecord to changing inferred CSV headers

2023-04-18 Thread James McMahon
Thanks very much for your reply, Matt. Yes sir, a Groovy script is my fallback option. Because we would rather build flows using "out of the NiFi box" processors instead of custom scripts that may need to be maintained, I was saving that as my last resort. But I do believe I can do it with Groovy.

Re: Generalizing QueryRecord to changing inferred CSV headers

2023-04-18 Thread Matt Burgess
I should mention for aggregate values like COUNT(), check out the CalculateRecordStats processor, not sure if it takes a `/` value (or whatever means 'select all fields') for a RecordPath or not, if not we should probably support if prudent. It might also be a nice improvement to add MAX/MIN

Re: Generalizing QueryRecord to changing inferred CSV headers

2023-04-18 Thread Matt Burgess
Jim, QueryRecord uses Apache Calcite under the hood and is thus at the mercy of the SQL standard (and any additional rules/dialect from Apache Calcite) so in general you can't select "all except X" or "all except change X to Y". Does it need to be SQL executed against the individual fields? If

Generalizing QueryRecord to changing inferred CSV headers

2023-04-18 Thread James McMahon
Hello. I recently asked the community a question about processing CSV files. I received some helpful advice about using processors such as ConvertRecord and QueryRecord, and was encouraged to employ Readers and RecordSetWriters. I've done that, and thank all who replied. My incoming CSV files