Member since
04-09-2018
2
Posts
1
Kudos Received
0
Solutions
04-10-2018
06:58 PM
1 Kudo
Folks, Considering I understood the use case well 🙂 Tried at my end.Attaching screenshot 1. GetFile gets CSV file 2. SplitText splits lines with Header 3. RouteOnAttribute skips Header and just passes data to be inserted and not header 4. ExtractText extracts columns from each line considering it is comma separated 5. ExecuteSQL checks if record already present 6. RouteOnAttribute differentiates between INSERT and UPDATE records 7. 2 ReplaceText either creates INSERT statement or UPDATE statement 8. PutSQL to execute statement received from ReplaceText upsert-csv-to-sql.png
... View more
04-09-2018
06:35 PM
Hi, How about below workaround ? For each record do a SQL select query using ExecuteSQL. Use flowfile attribute executesql.row.count which gives the number of records found. If there are no records means we need to insert. And if count is greater than 0, its an update. Have to play with RouteOnAttributes. Have not tried but seems a good use case. Will post an update once I try the same. @RANKESH NATH. @Rahul Soni. @Caio Boratto :- Do comment if anyone have tried or succeeded with this use case.
... View more