[ 
https://issues.apache.org/jira/browse/NIFI-15274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130228#comment-18130228
 ] 

Sejal Gupta commented on NIFI-15274:
------------------------------------

Thanks [~jmkofoed] , that's helpful. I looked at the existing services before 
picking an approach. {{DatabaseRecordLookupService}} (and the other 
{{RecordLookupService}} implementations) already return a whole Record for a 
single key, and {{LookupAttribute}} only accepts {{{}StringLookupService{}}}. 
So I don't think the lookup services need to change.

I'm proposing a new processor, {{{}LookupMultipleAttributes{}}}, which keeps 
{{LookupAttribute}} unchanged:
 * It takes a {{RecordLookupService}} and a {{Lookup Key}} property, which 
supports Expression Language.
 * It makes one lookup per FlowFile.
 * Each dynamic property maps an attribute name to a field name of the returned 
Record, e.g. {{{}myAttribute1 = field_X{}}}.
 * It routes to {{{}matched{}}}, {{unmatched}} or {{{}failure{}}}, and has an 
{{Include Empty Values}} option like {{{}LookupAttribute{}}}.

This covers your example: one lookup service, one key, several attributes. I've 
tested it against {{DatabaseRecordLookupService}} with {{Lookup Value Columns}} 
set to several columns. I'll open a PR shortly. If you'd prefer extending 
{{LookupAttribute}} instead, please say so.

> Lookup multiple attributes
> --------------------------
>
>                 Key: NIFI-15274
>                 URL: https://issues.apache.org/jira/browse/NIFI-15274
>             Project: Apache NiFi
>          Issue Type: New Feature
>    Affects Versions: 2.6.0
>            Reporter: Jens M Kofoed
>            Priority: Major
>
> The LookupAttribute processor allows you to lookup one key and set only one 
> dynamic attribute to a value received from the lookup service.
> It would be nice if it would be possible to set multiple dynamic attributes.
> This request will effect both a new LookupMultipleAttribute processor but 
> also the lookup services which should be able to return multiple values.
> A suggestion could might be something like this:
> Attribute name: keyfield - value=(keyfield in lookupservice)
> Attribute name: keyvalue - value=(the value you which to find in the keyfield)
> Dynamic attributes:
> Dynamic attribute values could be the return fieldname from the lookup 
> service eg:
> myAttribute1: field_X (return value from field_X)
> myAttribute2: field_Y (return value from field_Y)
> myAttribute3: field_Z (return value from field_Z)



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to