You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by John Burns <jz...@gmail.com> on 2016/01/14 14:54:29 UTC

Inserting data into mysql

Hi all,

Apologies if this is a basic question, but I don't readily see the answer
in the user guide.

So I have the following flow:

GetHTTP -> PutFile -> ExtractText -> RouteOnAttribute -> // I then want to
write the data into mysql//

So the ExtractText adds a new attribute to the file if it successfully
finds some text based on my regular expression. The RouteOnAttrbute then
sends the flowfile plus new attribute to some database insert processor.

This is where I'm stuck.

The docs for PutSQL require the incoming flow file to be SQL text. So
obviously I'm missing a processor step after RouteOnAttribute and before
PutSQL.

Basically the use case is to track websites for changing content, when some
content of interest appears, to write this into mysql database.

Does it need to be converted to JSON first?

Any help would be appreciated.

John

Re: Inserting data into mysql

Posted by John Burns <jz...@gmail.com>.
That sounds what I'm looking for Mark. Much appreciated.

Thanks

John
On 14 Jan 2016 14:08, "Mark Payne" <ma...@hotmail.com> wrote:

> John,
>
> You can use the ReplaceText processor to change the content of the
> FlowFile into whatever text you want it to be.
>
> You can use the Replacement Strategy of "Always Replace" and set the
> Replacement Value to the SQL that you want
> to use. Then you can send this to PutSQL.
>
> Does this give you what you're looking for?
>
> Thanks
> -Mark
>
> > On Jan 14, 2016, at 8:54 AM, John Burns <jz...@gmail.com> wrote:
> >
> > Hi all,
> >
> > Apologies if this is a basic question, but I don't readily see the
> answer in the user guide.
> >
> > So I have the following flow:
> >
> > GetHTTP -> PutFile -> ExtractText -> RouteOnAttribute -> // I then want
> to write the data into mysql//
> >
> > So the ExtractText adds a new attribute to the file if it successfully
> finds some text based on my regular expression. The RouteOnAttrbute then
> sends the flowfile plus new attribute to some database insert processor.
> >
> > This is where I'm stuck.
> >
> > The docs for PutSQL require the incoming flow file to be SQL text. So
> obviously I'm missing a processor step after RouteOnAttribute and before
> PutSQL.
> >
> > Basically the use case is to track websites for changing content, when
> some content of interest appears, to write this into mysql database.
> >
> > Does it need to be converted to JSON first?
> >
> > Any help would be appreciated.
> >
> > John
>
>

Re: Inserting data into mysql

Posted by Mark Payne <ma...@hotmail.com>.
John,

You can use the ReplaceText processor to change the content of the FlowFile into whatever text you want it to be.

You can use the Replacement Strategy of "Always Replace" and set the Replacement Value to the SQL that you want
to use. Then you can send this to PutSQL.

Does this give you what you're looking for?

Thanks
-Mark

> On Jan 14, 2016, at 8:54 AM, John Burns <jz...@gmail.com> wrote:
> 
> Hi all,
> 
> Apologies if this is a basic question, but I don't readily see the answer in the user guide.
> 
> So I have the following flow:
> 
> GetHTTP -> PutFile -> ExtractText -> RouteOnAttribute -> // I then want to write the data into mysql//
> 
> So the ExtractText adds a new attribute to the file if it successfully finds some text based on my regular expression. The RouteOnAttrbute then sends the flowfile plus new attribute to some database insert processor.
> 
> This is where I'm stuck. 
> 
> The docs for PutSQL require the incoming flow file to be SQL text. So obviously I'm missing a processor step after RouteOnAttribute and before PutSQL.
> 
> Basically the use case is to track websites for changing content, when some content of interest appears, to write this into mysql database. 
> 
> Does it need to be converted to JSON first?
> 
> Any help would be appreciated. 
> 
> John