Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi - How can i change ReplacementValue on ReplaceText ?

avatar
Explorer

I'm using ExecuteSQL,SplitAvro,ConvertAvroToJSON,EvaluateJsonPath,ReplaceText,ExecuteSQL.

 

 

I am trying to replace the content in the flowfile using replaceText processor.

Now, i can replace like this. -> INSERT INTO values (${id},'${name}') . ReplaceText process like this : 

INSERT into x values(1,'xx')

INSERT into x values(2,'yy')

INSERT into x values(3,'zz')

I'm sending INSERT query for each line.

 

But i want to send executesql process like this

INSERT INTO x  values (1,'xx'),(2,'yy'),(3,'zz')

 

 

 

1 ACCEPTED SOLUTION

avatar
Explorer

I used MergeContent and i solved my problem. Thanks !

View solution in original post

2 REPLIES 2

avatar
Super Guru

The flow that you are trying to implement is not very efficient and it's hard to achieve what you want to do in that way.

You should try to refactor it using record-based processors, which is much simpler and more efficient to handle a large number of records.

 

Something like this: ExecuteSQLRecord -> QueryRecord -> PutDatabaseRecord

 

  • ExecuteSQLRecord - Query and stream records from the source database
  • QueryRecord - convert the records from the source to target format. (e.g. SELECT id, value FROM FLOWFILE)
  • PutDatabaseRecord - insert the converted records into the target database.

André

--
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.

avatar
Explorer

I used MergeContent and i solved my problem. Thanks !