Member since
02-14-2024
6
Posts
3
Kudos Received
0
Solutions
03-06-2024
12:10 AM
I'm using a LookupRecord Processor to look up a MySQL table. The incoming Flow File Records is in Avro format have a column 'ID_BB_UNIQUE', which should be mapped to the field named 'ID_BB_Unique' in the MySQL table for lookup. After lookup, I return 'ID_BB_Unique' as 'Lookup_ID_BB_Unique' and insert this field value to the Flow File Records. However, the processor throwed me a java.lang.NullPointerException: null value for (non-nullable) string at nifiRecord.Lookup_ID_BB_Unique, while 'ID_BB_UNIQUE' in Flow File is confirmed to not have nulls, and 'ID_BB_Unique' is set to be not null in database. What might be causing this exception and how can I solve it? (If I choose 'Insert Entire Record' as Record Result Contents property in the processor, there is no such exception, but I believe it is not the correct logic to do my lookups and does not solve the problem from root.) LookupRecord Configuration: LookupService Configuration: Error:
... View more
Labels:
- Labels:
-
Apache NiFi
03-05-2024
11:43 PM
Hi @SAMSAL , I have thought to write a stored procedure to compare field values and then log value changes to solve problem 2, but one thing is that Records in a Flow File cannot be passed to a stored procedure and interact with the database data in a stored procedure directly. Maybe I didn't know the correct processor or script to use. Do you have any insight on this?
... View more
03-05-2024
11:42 PM
Hi @SAMSAL , I have thought to write a stored procedure to compare field values and then log value changes to solve problem 2, but one thing is that Records in a Flow File cannot be passed to a stored procedure and interact with the database data in a stored procedure directly. Maybe I didn't know the correct processor or script to use. Do you have any insight on this?
... View more
02-27-2024
11:15 PM
1 Kudo
I'm writing a flow in Apache NiFi. In the problematic part, I have a Flow File containing several records and a table (table 1) in MySQL Server which need to be updated. Every record in Flow File can be mapped to a row in table 1 based on values in a key column. Now I want to achieve the following goals: 1. Update fields in the matched row using field values in records as long as they are different. 2. Document the changes in another MySQL table (table 2), which has columns: the mentioned key column, date when field changes, revision id (a column from the record in Flow File), field id (i.e. which field has been changed. I have a table which maps column names to field id, FYI), old value, new value) For example, if a record in the Flow File is: { 'key': 1234, 'field_1': 'new_1', 'field_2': 'new_2', field_3': 'no_change_3' } and the corresponding row in table 1 is: { 'key': 1234, 'field_1': 'old_1', 'field_2': 'old_2', field_3': 'no_change_3' } After processing, the row in table 1 should become: { 'key': 1234, 'field_1': 'new_1', 'field_2': 'new_2', field_3': 'no_change_3' } and table 2 should have 2 new rows: { 'key': 1234, 'date': 'some date', 'revision_id': 'some revision id', 'field_id': 1, 'old_value': 'old_1', 'new_value': 'new_1' }, { 'key': 1234, 'date': 'some date', 'revision_id': 'some revision id', 'field_id': 2, 'old_value': 'old_2', 'new_value': 'new_2' } I used PutDatabaseRecord before to do the update, but in this way, I could not achieve the second goal as the Processor seems not allow for customized queries. Is there a way to achieve my purpose here?
... View more
Labels:
- Labels:
-
Apache NiFi
02-18-2024
06:44 PM
1 Kudo
Hi @MattWho , Thank you for the reply. I believe the FlowFile Concurrency and Outbound Policy can solve the detection problem. However, further, is there a way to run the downstream processors only once per batch of FlowFiles, as multiple FlowFiles will be released from the output port as a batch after I set Outbound Policy to Batch Output? (The downstream processor does not need to process any FlowFile but only calls some stored procedures in the database, so it should only run once per input to the overall flow.)
... View more
02-14-2024
01:27 AM
1 Kudo
Hi! I'm using NiFi 2.0.0 M1, and I'm writing a flow inside a processed group. I had a problem when I wrote the flow. The flow should be run as an individual task. Every time when it is run, it will take in some data from a table on MySQL Server, use many LookupRecord Processors and then process the matched and unmatched data respectively. Finally, it turns out to have 9 branches within the flow. After processing all these, I need to trigger an ExecuteSQLRecord processor which will call some stored procedures in MySQL. Literally, only when all the above branches finish running should this processor be triggered (and it should be triggered only once in one task). To achieve this, I wanted to use Notify and Wait processor to detect whether all the branches finish running and when I should trigger the ExecuteSQLRecord processor. However, I can only set a fixed number of signals to wait for in the Wait processor, while in the real case, sometimes not all of the 9 branches will be run. (Because, sometimes, there won't be matched or unmatched data for a lookup processor, and hence the corresponding branch won't be triggered to run.) Did anyone face the same problem as mine? Is there any good way to achieve my goal? (Below is part of the flow. You can see that I tried to use Wait but was kind of stuck there 😭)
... View more
Labels:
- Labels:
-
Apache NiFi