Support Questions

Find answers, ask questions, and share your expertise

NiFi PutSQL put contents

New Contributor

Hey all,

 

I'm trying to find a processor that will take the content of a flowfile and place that content in a database.

 

The only possible (and messy) solution I found was to move the content into an attribute, and store it like that. However attributes are stored in memory, and therefore this could get really messy really quickly. This is compounded by the fact that I am moving lots of file data around (1mb chunks).

 

The database I am using is a postgresql one, so I am storing it as a ByteA in the table itself.

 

Essentially I am looking for a PutFile processor, except it places the file in the table.

 

Any help is much appreciated, thanks.

1 REPLY 1

New Contributor

I am getting closer, but I am just missing something.

Currently I am trying to use the ReplaceText processor to wrap a statement around the content.

 

I get a statement like this:

INSERT INTO files VALUES('028f9b82-dc0f-43b6-a4a4-8bf1e51c595a','0f54f8f1e6e8ffc47cebf9fa28fbeeeb','1583353918908','TODO.txt','Test'::bytea);

 

When I run this directly in console I get the entry I am looking for. However when NiFi runs this same statement, I get '\x' (blank hex value) instead of the actual hex value for 'Hello World'.

 

Ex.

Run from console:

028f9b82-dc0f-43b6-a4a4-8bf1e51c595a | 0f54f8f1e6e8ffc47cebf9fa28fbeeeb | 1583353918908 | TODO.txt | \x54657374

 

Run from NiFi:

028f9b82-dc0f-43b6-a4a4-8bf1e51c595a | 0f54f8f1e6e8ffc47cebf9fa28fbeeeb | 1583353918908 | TODO.txt | \x

 

 

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.