Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
01-30-2017
10:25 AM
- last edited on
06-05-2026
09:25 AM
by
DianaTorres
How to execute multiple SQL queries in PutSql processor at a time
Ex: insert into table_a values('test_1'); insert into table_b values('test_2');
Flow:GetFile -> ReplaceText -> PutSQL -> PutFile
In the above flow ReplaceText processor will replace the flow file with above example query.
With this SQL flow file PutSql processor getting triggered and failed with error.
Created 01-30-2017 01:21 PM
The PutSQL processor expects that each FlowFile contains a single SQL statement and does not support multiple insert statements as you have tried above. You can have the GetFile Processor route its success relationship twice with each success going to its own ReplaceText processor. Each ReplaceText processor is then configured to create either the "table_a" or "table_b" insert statement. The success from both ReplaceText processors could then be routed to the same PutSQL processor.
Thanks,
Matt
Created 01-30-2017 01:21 PM
The PutSQL processor expects that each FlowFile contains a single SQL statement and does not support multiple insert statements as you have tried above. You can have the GetFile Processor route its success relationship twice with each success going to its own ReplaceText processor. Each ReplaceText processor is then configured to create either the "table_a" or "table_b" insert statement. The success from both ReplaceText processors could then be routed to the same PutSQL processor.
Thanks,
Matt
Created 01-30-2017 01:59 PM
@Matt
Thank you for your clarification.