Member since
11-25-2018
3
Posts
0
Kudos Received
0
Solutions
11-25-2018
09:57 PM
Thank you Shu, it worked 🙂
... View more
11-25-2018
06:08 PM
@Shu This is the current Nifi flow ConsumeKafka -> UpdateAttribute -> ReplaceText -> PutSQL *In UpdateAttribute I am capturing kafka.topic, kafka.offset,kafka.partition, kafka.key and assigning to variables. topic=${kakfa.topic} partition=${kakfa.partition} offset=${kakfa.offset} key=${kakfa.key} *In ReplaceText processor I am replacing the flowfile content with insert statement. searchvalue = (?s)(^.*$) replacementvalue = Insert into test_schema.table1(topic, partition, offset, key, value) values ('${topic}','${partition}','${offset}','${key}','$1') But the nifi workflow is failing since the kafka value has single quotes in it as mentioned in initial post and sql server wont allow single quotes into the varchar column unless we double the single quote. I want to add one more ReplaceText processor and search the kafka value string and replace all the single quote occurrences with two single quotes. Please let me know what should be the search value and replacement value in the Replacetext processor. Please let me know if there is a better way to handle this scenario. Thanks
... View more
11-25-2018
01:40 AM
I am trying to consume data from kafka and insert into sql server. The kafka value has single quotes in it eg: "O'Keefe". PutSQL processor is failing to insert the string value into SQL server varchar column. I would like to replace the single quote with two single quotes in nifi so that I can insert the kafka value with single quote into sql server. Can you please give an example of replacetext processor how to achieve this. Input: O'Keefe Output: O''Keefe Thanks
... View more
Labels:
- Labels:
-
Apache Kafka
-
Apache NiFi