Member since
11-12-2016
71
Posts
11
Kudos Received
0
Solutions
12-08-2016
04:31 PM
Beloved forum, is it possible to have dynamic query using ExecuteSQL processor ? e.x. FileX.txt content (comma separated)
XXXXX, BBBBB, CCCCC, CCCDD
XXXXX, EEEEE, CCCCC, DDDDD
outputstream
XXXXX, BBBBB, CCCCC, CCCDD, 'select customer_name from table where id=CCCDD limit 1'
XXXXX, EEEEE, CCCCC, DDDDD, 'select customer_name from table where id=DDDDD limit 1'
I want to amend the select statement result to the original file ? Thankssss
... View more
Labels:
- Labels:
-
Apache NiFi
11-27-2016
08:56 AM
Hello forum, I got the below example from funnifi blog, thanks to Matt 🙂 I have 2 questions on this ? 1- Groovy supposed to be Java like language, classes and methods... but I can't see this in the below example ? no class or method declaration ? 2- If I want to add conditions to the code and modify the output based on this. e.g. if field 3 (column C) starts with 3300, replace 33 with 22 if field 3 (column C) starts with 0, replace this 0 with 00212 how to achieve this ? Input file: a1|b1|c1|d1
a2|b2|c2|d2
a3|b3|c3|d3 Desired output: b1 c1
b2 c2
b3 c3 script: import java.nio.charset.StandardCharsets
def flowFile = session.get()
if(!flowFile) return
flowFile = session.write(flowFile, {inputStream, outputStream ->
inputStream.eachLine { line ->
a = line.tokenize('|')
outputStream.write("${a[1]} ${a[2]}\n".toString().getBytes(StandardCharsets.UTF_8))
}
} as StreamCallback)
session.transfer(flowFile, REL_SUCCESS)
... View more
Labels:
- Labels:
-
Apache NiFi
11-22-2016
12:19 PM
Thanks Matt, very helpful is there anyway to use "Load into" instead of SQL insert ?
... View more
11-20-2016
07:08 PM
1 Kudo
Hi all, Am trying to build SQL loader using NiFi, the thing which is a bit strange is that I have to split the input file (containing insert statments) to multiple files each containing only one SQL insert, is this the best practice ? why I cant send the whole file to putSQL processor ? Thanks
... View more
Labels:
- Labels:
-
Apache NiFi
11-20-2016
06:55 PM
Thanks for your answer, is there any workaround for that ? any suggestion ? I need to trigger email/alarm incase I have connection issue (putSQL) processor ?
... View more
11-20-2016
06:51 PM
Thanks Timothy, Well, before PutSQL, incase there is a DB connection issue and and queue reaches to X level, I want to recieve some kind of alarm..
... View more
- « Previous
- Next »