Member since
09-27-2017
11
Posts
1
Kudos Received
0
Solutions
11-17-2017
01:34 PM
Hi Team, I'm trying to execute sql update query *update student set maxqueryid=0 where id=1;*. using ExecuteSQL Processor. It resulted with error saying data manuplation cannot be done since it accepts only select statements. How do I achieve this usecase is there any procesor to do this job. Any suggestion would be appreciated. Thnaks Rakesh.
... View more
Labels:
- Labels:
-
Apache NiFi
10-18-2017
11:18 AM
Hi All, I have json flow file with values in Mon Oct 09 23:38:55 IST 2017 format. I'm trying to change format to '2017-09-11 19:56:13'. to accomplish this I selected ExecuteScript Processor below is my groovy script which is not working. Please give me any suggestion on this. Thanks Rakesh. import org.apache.commons.io.IOUtils
import java.nio.charset.*
def flowFile = session.get()
if(!flowFile) return
flowFile = session.write(flowFile, {inputStream, outputStream ->
def jsonSlurper = new JsonSlurper()
def object = jsonSlurper.parseText(flowFile)
assert object instanceof Map
object.each { key,value ->
String Regex = "([a-zA-Z]{3} [a-zA-Z]{3} \d{2} \d{2}\:\d{2}\:\d{2} [a-zA-Z]{3} \d{4})"
if($value ==~ Regex){
$value = toDate("EEE MMM dd HH:mm:ss z yyyy"):toNumber():format("yyyy-MM-dd HH:mm:ss.S")
}
}
outputStream.write(object)
} as StreamCallback)
flowFile = session.putAttribute(flowFile)
session.transfer(flowFile, REL_SUCCESS)
... View more
Labels:
- Labels:
-
Apache NiFi