apache-nifi

Difference between Apache Beam and Apache Nifi

只愿长相守 提交于 2019-12-04 00:44:14
问题 What are the use cases for Apache Beam and Apache Nifi? It seems both of them are data flow engines. In case both have similar use case, which of the two is better? 回答1: Apache Beam is an abstraction layer for stream processing systems like Apache Flink, Apache Spark (streaming), Apache Apex, and Apache Storm. It lets you write your code against a standard API, and then execute the code using any of the underlying platforms. So theoretically, if you wrote your code against the Beam API, that

nifi ConvertRecord JSON to CSV getting only single record?

自古美人都是妖i 提交于 2019-12-03 10:15:03
I have the below flow set up for reading json data and convert it to csv using the convertRecord processor. However, the output flowfile is only populated with single record (I am assuming only the first record) instead of all the records. Can someone help provide the correct configuration? Source json data: {"creation_Date": "2018-08-19", "Hour_of_day": 7, "log_count": 2136} {"creation_Date": "2018-08-19", "Hour_of_day": 17, "log_count": 606} {"creation_Date": "2018-08-19", "Hour_of_day": 14, "log_count": 1328} {"creation_Date": "2018-08-19", "Hour_of_day": 20, "log_count": 363} flow:

PutSql - date format error

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 14:10:10
问题 I'm trying to read data from 'Teradata' and populate the same to 'Oracle' database. Please find below my flow, 'ExecuteSQL' -> 'SplitAvro' -> 'ConvertAvroToJSON' -> 'ConvertJSONToSQL' -> 'PutSQL' Error message: Cannot update database for StandardFlowFileRecord due to org.apache.nifi.processor.exception.ProcessException: The value of the sql.args.7.value is '2999-12', which cannot be converted to a timestamp; routing to failure: org.apache.nifi.processor.exception.ProcessException: The value

How to update line with modified data in Jython?

百般思念 提交于 2019-12-02 09:10:48
I'm have a csv file which contains hundred thousands of rows and below are some sample lines.., 1,Ni,23,28-02-2015 12:22:33.2212-02 2,Fi,21,28-02-2015 12:22:34.3212-02 3,Us,33,30-03-2015 12:23:35-01 4,Uk,34,31-03-2015 12:24:36.332211-02 I need to get the last column of csv data which is in wrong datetime format. So I need to get default datetimeformat( "YYYY-MM-DD hh:mm:ss[.nnn]" ) from last column of the data. I have tried the following script to get lines from it and write into flow file. import json import java.io from org.apache.commons.io import IOUtils from java.nio.charset import

How to extract a subset from a CSV file using NiFi

為{幸葍}努か 提交于 2019-12-02 09:02:33
I have a csv file say with 100+ columns and I want to extract only specific 60 columns as a subset(both column name + its value). I know we can use Extract Text processors. Can anyone tell me what regular expression to write ? Ex- Lets say from the given snapshot I only want NiFi to Extract 'BMS_sw_micro', 'BMU_Dbc_Dbg_Micro', 'BMU_Dbc_Fia_Micro' columns i.e. Extract only column 'F,L,O'. any help is much appreciated! As I said in the comment, you can Count the number of commas before the text, you want to match and use that in the RegEx, like this: /(?<=^([^,]+?,){5})[^,]+/ What the RegEx do

How to extract a subset from a CSV file using NiFi

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 06:54:19
问题 I have a csv file say with 100+ columns and I want to extract only specific 60 columns as a subset(both column name + its value). I know we can use Extract Text processors. Can anyone tell me what regular expression to write ? Ex- Lets say from the given snapshot I only want NiFi to Extract 'BMS_sw_micro', 'BMU_Dbc_Dbg_Micro', 'BMU_Dbc_Fia_Micro' columns i.e. Extract only column 'F,L,O'. any help is much appreciated! 回答1: As I said in the comment, you can Count the number of commas before the

I have two Json payload. I want to merge them in a single Json object

妖精的绣舞 提交于 2019-12-02 04:49:10
I have two payloads and want to merge them into single JSON object (streaming join). At few places people are suggesting to use AttributesToJSON, but as one of the JSON does not have fix set of attributes I guess that would not be possible. First payload is { "title":"API-Actions Documentation", "title_link":"https://api.slack.com/", "author_name":"name", "author_link":"http://flickr.com/bobby/", "author_icon":"http://flickr.com/icons/bobby.jpg", "text":"Optional", "image_url":"http://my-website.com/path/to/image.jpg", "thumb_url":"http://example.com/path/to/thumb.png", "footer":null, "pretext

Nifi PutSQL Timestamp/Datetime error cannot be converted error

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:24:07
问题 I tried the solution suggested to remove the timestamp format conversion error by using "UpdateAttribute" processor i.e. ConvertJSONtoSQL-> UpdateAttribute--> PutSQL In UpdateAttribute I used Property Value --------------- ------------------------ sql.args.4.value -> ${sql.args.4.original:format("yyyy-MM-dd HH:mm:ss")} Log: The value of the sql.args.4.value is '', which cannot be converted to a timestamp at org.apache.nifi.processors.standard.PutSQL.setParameters(PutSQL.java:690) at Without

How to invoke a remote REST service in NiFi

旧时模样 提交于 2019-12-01 18:18:48
Is it possible to use xmlHttpRequest in NIFI processor to invoke remote rest service? In my case the ExecuteScript processor (using Javascript) can't evaluate XMLHttpRequest ; is there any similar solution I can use to get response data? var OutputStreamCallback = Java.type("org.apache.nifi.processor.io.OutputStreamCallback"); var StandardCharsets = Java.type("java.nio.charset.StandardCharsets"); Date.prototype.isValid = function () { return (Object.prototype.toString.call(this) === "[object Date]") && !isNaN(this.getTime()); }; var flowFile = session.get(); if (flowFile != null) { var

How to invoke a remote REST service in NiFi

冷暖自知 提交于 2019-12-01 18:00:53
问题 Is it possible to use xmlHttpRequest in NIFI processor to invoke remote rest service? In my case the ExecuteScript processor (using Javascript) can't evaluate XMLHttpRequest ; is there any similar solution I can use to get response data? var OutputStreamCallback = Java.type("org.apache.nifi.processor.io.OutputStreamCallback"); var StandardCharsets = Java.type("java.nio.charset.StandardCharsets"); Date.prototype.isValid = function () { return (Object.prototype.toString.call(this) === "[object