Created 04-14-2021 07:50 AM
Hi,
I am fetching some HQL files from GitHub using InvokeHTTP processor and executing the SQL using PutHiveQL processor. The challenge is that the HQL files are having reference of some nifi attributes and those attribute values are not getting populated but those attributes are present in the flow file.
Example:
HQL file content:
select * from tbl_sales where load_date='${load_date}';
InvokeHTTP processor response:
select * from tbl_sales where load_date='${load_date}';
My understanding is that once the response comes to nifi then it renders the flow file content and it should automatically populate the date value (eg. '2021-04-14') instead of the string reference i.e. '${load_date}'.
I need your expertise to confirm if it is the expected behaviour of nifi that it should only be getting the HQL content as it is and not rendering it to the actual attribute value. If not then can somebody please help how to get this attribute value populated?
Here is the screenshot of the flow:
Thanks!
Created 04-15-2021 05:54 AM
Unfortunately variables cannot be inside other dynamic parameters. It is already rendered by then.
What you can do is store this part
select * from tbl_sales where load_date=
then updateattribute
query
${result:append( "'" +${load_date} +"'")}
Created 04-19-2021 03:08 AM
@TimothySpann Thanks for your response.
Actually, the use case I am working on is having multiple flow file attributes.
Additionally,
1. The solution you have suggested is treating the result as an attribute but in our case, the result is the flow file content.
2. For multiple attributes this solution is very complicated.
Appreciate it if you can suggest something.
Thanks!
Created 04-19-2021 04:40 AM
QueryRecordProcessor grabs fields from content
You can also add attributes there
You can also add attributes via updaterecord
https://www.datainmotion.dev/2020/12/smart-stocks-with-flank-nifi-kafka.html