How to use WHERE statement in ni-fi QueryRecord processor?

Viewed 49

So I have this dummy csv file:

year, value
2001,А
2001,B
2002,A
2021,B
2022,A
2022,B

I've ingested it using GetFile processor and now I am trying to create few files out of this one according to a value of "year" column.

So I am using QueryRecord processor and I've created a couple of attributes in this processor such as:

year_2001: select * from flowfile where year = 2001  (also I've tried year = '2001')
year_2022: select * from flowfile where year = 2022

But when I start this processor I am getting some huge error I don't understand. It is too huge to copy here but basically it says that my SQL statement ain't valid. When I remove "where" clause it works fine, so apparently it is the "where" clause that I don't seem to get right.

Thank you beforehand.

UPD. I've found this article and it seems like I do exactly same as example shows.

1 Answers

Ok, I have figure this out. Apparently naming my column "year" wasn't such a good idea. Seems like it conflicted with year function or something. So I just enclosed year in quotes and it worked.

So the correct sql statement will be
select * from flowfile where "year" = '2001'

Related