You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by l vic <lv...@gmail.com> on 2018/10/23 20:36:49 UTC

how to merge attributes?

I have to create sql query from results of rest call (InvokeHttp ) and
original request parameters...

Any idea how i can merge attributes from both in single flowfile for
passing it to "ReplaceText"? If I pass both "Original" and "Result" from
"InvokeHttp" to "ReplaceText" I end up with one "valid" flowfile using
attributes from both and one "junk" one with empty placeholders... If I try
use "MergeContent" to  merge flows I end up only with junk only like the
following


update joint_table set create_date = 1540321085127, filter = '',
data_start_time =  + 1532016495 - , execute_date = 1532016495 + where id =
'1749462c-ed2b-4a34-9332-3687a60c1e1c'


Thank you

Re: how to merge attributes?

Posted by Koji Kawamura <ij...@gmail.com>.
Hi Victor,

Excuse me, I meant "Response" relationship while I typed "Result".
Please take a look on this example flow template for detail.
https://gist.github.com/ijokarumawak/0f80d2e0c691b0c9bb4721eea340ad52

Also, this screenshot describes what the example flow does.
https://gist.githubusercontent.com/ijokarumawak/0f80d2e0c691b0c9bb4721eea340ad52/raw/51e25ecb2032cdaab11d3ec8eec4dce28e1a0ced/1.screenshot.png

Thanks,
Koji
On Wed, Oct 24, 2018 at 10:16 PM l vic <lv...@gmail.com> wrote:
>
> Not sure I understand: "InvokeHttp" offers 5 relationships: "Failure", "No Retry",  "Original", "Response", "Retry" with incoming FlowFile created for "matched" relationship...Don't see any "Result" and "Response" flowfile doesn't seem to contain input attributes. I work with ver. 1.7.0 of nifi
> Thank you,
> Victor
>
> On Tue, Oct 23, 2018 at 10:16 PM Koji Kawamura <ij...@gmail.com> wrote:
>>
>> Hello,
>>
>> InvokeHttp creates a new FlowFile for "Result" relationship from the
>> incoming FlowFile. That means, the FlowFile for "Result" carries all
>> attributes copied that the incoming one has. You just need to connect
>> the "Result" relationship to ReplaceTest. "Original" can be
>> auto-terminated in this case.
>>
>> Thanks,
>> Koji
>> On Wed, Oct 24, 2018 at 5:37 AM l vic <lv...@gmail.com> wrote:
>> >
>> > I have to create sql query from results of rest call (InvokeHttp ) and original request parameters...
>> >
>> > Any idea how i can merge attributes from both in single flowfile for passing it to "ReplaceText"? If I pass both "Original" and "Result" from "InvokeHttp" to "ReplaceText" I end up with one "valid" flowfile using attributes from both and one "junk" one with empty placeholders... If I try use "MergeContent" to  merge flows I end up only with junk only like the following
>> >
>> >
>> > update joint_table set create_date = 1540321085127, filter = '', data_start_time =  + 1532016495 - , execute_date = 1532016495 + where id = '1749462c-ed2b-4a34-9332-3687a60c1e1c'
>> >
>> >
>> > Thank you

Re: how to merge attributes?

Posted by l vic <lv...@gmail.com>.
Not sure I understand: "InvokeHttp" offers 5 relationships: "Failure", "No
Retry",  "Original", "Response", "Retry" with incoming FlowFile created for
"matched" relationship...Don't see any "Result" and "Response" flowfile
doesn't seem to contain input attributes. I work with ver. 1.7.0 of nifi
Thank you,
Victor

On Tue, Oct 23, 2018 at 10:16 PM Koji Kawamura <ij...@gmail.com>
wrote:

> Hello,
>
> InvokeHttp creates a new FlowFile for "Result" relationship from the
> incoming FlowFile. That means, the FlowFile for "Result" carries all
> attributes copied that the incoming one has. You just need to connect
> the "Result" relationship to ReplaceTest. "Original" can be
> auto-terminated in this case.
>
> Thanks,
> Koji
> On Wed, Oct 24, 2018 at 5:37 AM l vic <lv...@gmail.com> wrote:
> >
> > I have to create sql query from results of rest call (InvokeHttp ) and
> original request parameters...
> >
> > Any idea how i can merge attributes from both in single flowfile for
> passing it to "ReplaceText"? If I pass both "Original" and "Result" from
> "InvokeHttp" to "ReplaceText" I end up with one "valid" flowfile using
> attributes from both and one "junk" one with empty placeholders... If I try
> use "MergeContent" to  merge flows I end up only with junk only like the
> following
> >
> >
> > update joint_table set create_date = 1540321085127, filter = '',
> data_start_time =  + 1532016495 - , execute_date = 1532016495 + where id =
> '1749462c-ed2b-4a34-9332-3687a60c1e1c'
> >
> >
> > Thank you
>

Re: how to merge attributes?

Posted by Koji Kawamura <ij...@gmail.com>.
Hello,

InvokeHttp creates a new FlowFile for "Result" relationship from the
incoming FlowFile. That means, the FlowFile for "Result" carries all
attributes copied that the incoming one has. You just need to connect
the "Result" relationship to ReplaceTest. "Original" can be
auto-terminated in this case.

Thanks,
Koji
On Wed, Oct 24, 2018 at 5:37 AM l vic <lv...@gmail.com> wrote:
>
> I have to create sql query from results of rest call (InvokeHttp ) and original request parameters...
>
> Any idea how i can merge attributes from both in single flowfile for passing it to "ReplaceText"? If I pass both "Original" and "Result" from "InvokeHttp" to "ReplaceText" I end up with one "valid" flowfile using attributes from both and one "junk" one with empty placeholders... If I try use "MergeContent" to  merge flows I end up only with junk only like the following
>
>
> update joint_table set create_date = 1540321085127, filter = '', data_start_time =  + 1532016495 - , execute_date = 1532016495 + where id = '1749462c-ed2b-4a34-9332-3687a60c1e1c'
>
>
> Thank you