Skip to main content
ebeb
Gold ⭐️⭐️
February 9, 2022
Solved

Nifi - how to run a simple standalone INSERT SQL statement

Hello Experts,

 I want to run a simple Hive Insert SQL statement in Nifi periodically for example:

insert overwrite Table1 select * from Table2; 

All SQL values are fixed hardcoded and don't need to be changed dynamically in the flow. As a newbie I was thinking I could write the flow as:

 

ReplaceText->success->PutHiveQL

 

Search Value:  (?s)(^.*$)
Replacement Value:  insert overwrite Table1 select * from Table2; 
 
But I have an error in ReplaceText which probably needs an incoming flowfile which I don't have since the SQL is fixed hardcoded:
"Upstream Connections is invalid because Processor requires an upstream connection but currently has none." 
 
The other option I could try but not sure it will work is:

GenerateFlowFile -> success -> PutHiveQL

GenerateFlowFile Custom Text: insert overwrite Table1 select * from Table2;

 
 

 

  

araujo
araujoAnswer
Platinum ⭐️⭐️⭐️
February 10, 2022

The alternative your mentioned of using GenerateFlow file is the way to go here.

-- Was your question answered? Please take some time to click on "Accept as Solution" below this post. If you find a reply useful, say thanks by clicking on the thumbs up button.

1 reply

araujo
Platinum ⭐️⭐️⭐️
araujoAnswer
Platinum ⭐️⭐️⭐️
February 10, 2022

The alternative your mentioned of using GenerateFlow file is the way to go here.

Translate
-- Was your question answered? Please take some time to click on "Accept as Solution" below this post. If you find a reply useful, say thanks by clicking on the thumbs up button.