Member since
07-29-2020
574
Posts
323
Kudos Received
176
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 3584 | 12-20-2024 05:49 AM | |
| 3828 | 12-19-2024 08:33 PM | |
| 3630 | 12-19-2024 06:48 AM | |
| 2364 | 12-17-2024 12:56 PM | |
| 3115 | 12-16-2024 04:38 AM |
05-19-2023
05:23 AM
You can use ExecuteSQL pr ExecuteSQLRecord Processor for that. The first one will give you the result in avro format and the second one you can specify the format of the output by setting the record writer property.
... View more
05-13-2023
06:52 AM
Hi @Arash , Not sure if there is a reader\writer that can work semi-structured data. You can develop your custom reader\writer but that will be an effort. Since you are getting your input as multiple json records lines you can either use SplitText processor to split each json record into its own flowfile and then process each record independently, or convert the input into Json array using two ReplaceText processors ( see screenshot below), then use QueryRecord & UpdateRecord with JsonTreeReader\Writer. First ReplaceText: replace line break with comma 2ed ReplaceText: Surround the entire text with [] Hope that helps. Thanks
... View more
05-12-2023
09:42 AM
Hi @rafy , I dont think the QueryRecord is suppose to work this way but I could be wrong. The query record basically filters from the root array and not the nested array. Since your input is not an array json object on the root this is not going to work. and if the filter " RPATH_STRING(data, '/room')='A'" is suppose to work (not sure why its not) it will return the entire record from the root and not just the subset. I think the question has been asked before but there was no answer: https://community.cloudera.com/t5/Support-Questions/Select-a-subset-of-data-using-NiFi-QueryRecord/td-p/348002 Now to resolve your problem, you have two options of processors : Option 1: EvaluateJsonPath->QueryRecord->JsonJoltTransformation where processors are configured as follows: EvaluateJsonPath : to get the data array into root array QueryRecord : To Query the required record based on the ${ip} attribute: JsonJoltTransformation: To convert back to the required schema with data array spec: [
{
"operation": "shift",
"spec": {
"*":"data[#].&"
}
}
] Option 2: Just one JoltTransformationJson with the following spec: [
{
"operation": "shift",
"spec": {
"data": {
"*": {
"room": {
"${ipAttr}": {
"@2": "data[0]"
}
}
}
}
}
}
] Note: I had to change the ip attribute name to ipAttr since ip is reserved Expression Language function.
... View more
05-11-2023
03:50 PM
I think you had it right but you need to convert the division value into string before applying split on it. Here are the steps: "decImporto": "=divide(@(1,Importo),@(3,Quantita))",
"strImporto": "=toString(@(1,decImporto))",
"array_importo": "=split('[.]',@(1,strImporto))",
"pad_importo": "=rightPad(@(1,array_importo[1]), 8, '0')",
"Importo": "=concat(@(1,array_importo[0]),'.',@(1,pad_importo))"
... View more
05-11-2023
11:43 AM
Hi, Please see the modified spec below. The comments indicate what I had to do to make your modify-overwrite-beta spec works based on the input json. I hope it works. [{
"operation": "modify-overwrite-beta",
"spec": {
"FatturaElettronicaBody": {
// The DatiGenerali level is not found in the input JSON
// "DatiGenerali": {
"DatiBeniServizi": {
"DettaglioLinee": {
"*": {
//level3
"ScontoMaggiorazione": {
// level2
"*": {
// Quantita is located level 3 and not level 1
"Importo": "=divide(@(1,Importo),@(3,Quantita))"
}
}
}
}
}
//}
}
}
}]
... View more
05-11-2023
09:28 AM
Hi, Will that helps: https://stackoverflow.com/questions/45052625/how-can-i-change-the-timezone-of-a-column-in-apache-nifi
... View more
05-08-2023
12:48 PM
Hi, I believe this spec would help with setting the date as default date in each array element: [
{
"operation": "modify-overwrite-beta",
"spec": {
"FatturaElettronicaBody": {
"DatiGenerali": {
"DatiDDT": {
"NumeroDDT": "=split('[,]',@(1,NumeroDDT))"
}
}
}
}
},
{
"operation": "shift",
"spec": {
"FatturaElettronicaBody": {
"DatiGenerali": {
"DatiGeneraliDocumento": "FatturaElettronicaBody.DatiGenerali.&",
"DatiDDT": {
"NumeroDDT": {
"*": {
"@": "FatturaElettronicaBody.DatiGenerali.DatiDDT[&1].NumeroDDT",
"@(3,DatiGeneraliDocumento.Data)": "FatturaElettronicaBody.DatiGenerali.DatiDDT[&1].Date"
}
}
}
}
}
}
}
] If that helps please accept solution.
... View more
05-08-2023
10:27 AM
1 Kudo
What is the "Completion Strategy" property under FetchSFTP is set to? If its set to the default "None" then the file should not be deleted or moved. See the Completion Strategy options under: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.20.0/org.apache.nifi.processors.standard.FetchSFTP/index.html If that helps please accept solution.
... View more
05-08-2023
09:47 AM
if what you provided seems to be giving you the expected output then you are good to go :).
... View more
05-08-2023
07:58 AM
Hi, See if this helps: [
{
"operation": "shift",
"spec": {
"header": {
"timeStamp": "records.inv_activity_ts",
"activityId": "records.inv_activity_id",
"action": "records.action"
},
"resource": {
"drniId": "records.inv_id",
"subtype": "records.inv_subtype",
"name": "records.inv_name",
"resourceCharacteristic": {
"*": {
"name": {
"status": {
"$": "records.status",
"@(2,value)": "records.matchingStatus_value"
},
"installDate": {
"@(2,value)": "records.installDate"
}
}
}
}
}
}
}
] If that helps please accept solution. Thanks
... View more