Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Use Filename for sql query


Use Filename for sql query

New Contributor


I’m new to using NiFi so this may seem like a rather ambitious plan.

What I want to do is the following:

- Use a processor (GetFile) to grab a name from a folder

- Only grab a portion of the filename (ie: just the ‘Fred’ in ‘Fred_01_abc0001.txt’)

- Run an SQL query using this attribute (ie: select * from table where name=‘Fred’)

- if the result is null, move file from step one into ‘broken’ folder else move file to ‘processing’ folder

I’d be keen to get some help as to where to start or if someone has done this before?

Appreciate any help or guidance :)