Created 01-30-2017 10:25 AM
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.