Support Questions
Find answers, ask questions, and share your expertise

Get DB record and map them to a new column to csv

Get DB record and map them to a new column to csv

Explorer

My scenario...

 

In my database(postgresql) table, I have following columns.

 

locationID,addressID,siteName
1,121,colombo
43,232,kandy

 

 

In my flowfile. I have

 

locationID,addressID
1,121
43.232

 

Now I want to read from the database and flow file. Map locationID and addressID and add a new column to my flow file as locationName.

 

So my final flow file should also be like

 

locationID,addressID,siteName
1,121,colombo
43,232,kandy

 

 

I have tried to use QueryDatabaseTableRecord processor. But  dont know how to map flowfile content and database read.

 

 

2 REPLIES 2

Re: Get DB record and map them to a new column to csv

Cloudera Employee

To clarify, are you trying to 1) do a conditional lookup against the database using the FlowFile content, or are you 2) pulling data based on some other criteria, then wanting to perform the lookup/join/mapping during NiFi processing?

Re: Get DB record and map them to a new column to csv

Explorer

1) do a conditional lookup against the database using the FlowFile content... and then those lookup values are written back to flowfile and other processors use this flowfile.