Member since
11-16-2015
911
Posts
668
Kudos Received
249
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 713 | 09-30-2025 05:23 AM | |
| 1076 | 06-26-2025 01:21 PM | |
| 933 | 06-19-2025 02:48 PM | |
| 1104 | 05-30-2025 01:53 PM | |
| 12298 | 02-22-2024 12:38 PM |
03-23-2017
03:46 PM
1 Kudo
As you suggested, you can use the JoltTransformJSON processor to "flatten" your JSON, but if your use case is as simple as the provided example (where the fields are one level down), you could also use EvaluateJsonPath with the target set to flowfile-content and the JSONPath expression set to $.Person
... View more
03-22-2017
06:05 PM
I wonder if the slashy string is causing the problem. Since you don't have any single quotes in your command, maybe try enclosing the command in single quotes rather than slashes.
... View more
03-22-2017
06:03 PM
Do you mind formatting the code in a "code" block? I see two definitions of copyCommand (you probably wanted to remove the one with all your hostname/port user/pass info)
... View more
03-21-2017
08:12 PM
1 Kudo
With the ExecuteScript processor, you are likely just adding Dynamic Properties (also known as User-Defined Properties), which are not sensitive. To add your own sensitive properties to a scripted processor, you would need to use InvokeScriptedProcessor. There's an example from the NiFi mailing list (though not with sensitive properties, you'd just need to add .sensitive(true) to your PropertyDescriptor.Builder, and I have another example (with no added properties) on my blog.
... View more
03-20-2017
02:20 PM
Can you edit your question to include the code you're using to store the value into the state map (and update the StateManager with it)?
... View more
03-17-2017
05:12 PM
You can put sqljdbc42.jar somewhere else and point to it in the Database Driver Location property. There might be issues with backslashes and/or Windows pathnames, I think there are other HCC questions/answers that address this.
... View more
03-15-2017
11:38 PM
3 Kudos
Yes it is possible with ExecuteScript if nothing else. Try the following Groovy script in your ExecuteScript processor: def flowFile = session.get()
if(!flowFile) return
class WriteCallback implements OutputStreamCallback {
Map attrs
WriteCallback(attributes) {
attrs = attributes
}
void process(OutputStream outputStream) {
outputStream.write('<root>\n'.bytes)
attrs.each {k,v ->
outputStream.write("<property>\n\t<name>$k</name>\n\t<value>$v</value>\n".bytes)
}
outputStream.write('</root>'.bytes)
}
}
def wb = new WriteCallback(flowFile.attributes)
flowFile = session.write(flowFile, wb)
flowFile = session.putAttribute(flowFile, org.apache.nifi.flowfile.attributes.CoreAttributes.MIME_TYPE.key(), 'application/xml')
session.transfer(flowFile, REL_SUCCESS) This should pretty-print your attributes in a "properties-style" XML format. Of course you can edit the script to give you the schema you like.
... View more
03-15-2017
01:11 PM
1 Kudo
In addition to QueryDatabaseTable, you may be interested in the GenerateTableFetch processor. It is similar to QueryDatabaseTable except that it does not execute SQL queries, it generates them and sends out flow files with SQL queries. This allows you to distribute to the fetching in parallel over a NiFi cluster. In an upcoming release, GenerateTableFetch will accept incoming flow files, so you could enhance the workflow with the ListDatabaseTables processor, sending those tables to GenerateTableFetch, thus parallelizing the fetching of multiple pages of multiple tables.
... View more
03-15-2017
12:56 PM
1 Kudo
Currently NiFi does not support XLS as a format, but there has been a community contribution to add a ConvertExcelToCSV processor under NIFI-2613.
... View more
03-15-2017
12:52 PM
1 Kudo
For CSV files, if you know the number and type of column values, you can use SplitText (to get one row per flow file) followed by ExtractText, supplying a regular expression to get the column values out into flow file attributes. Then you can use ReplaceText to manually enter a SQL INSERT statement (using NiFi Expression Language to access the attributes). For other formats like Avro, as we don't currently have a ConvertAvroToSQL processor, you'd have to convert them for now. Work is underway for a generic system of type conversions, such that you could specify Avro as your input format and perhaps "SQL INSERT" as your output format, thereby effectively making the generic processor work like a ConvertAvroToSQL processor.
... View more