Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How can I use variable on query of executeSQL processor on apache NiFi?

avatar
New Contributor

Hi. I am a newbie in NiFi.

I would like to use query using variable on ExecuteSQL processor.

My query is like this:

select * from tmp_table where std_date='${target_day}'

I want to execute this query once a day using different date value.

This is simple test.

How can I use dynamic values on query?

thank you.

2 REPLIES 2

avatar
Master Guru
@YoungHeon Kim

As ExecuteSQL processor SQL select query property supports expression language so you can use

select * from tmp_table where std_date='${now():format('yyyy-MM-dd')}'

this query is similar to

select * from tmp_table where std_date='2018-02-26'

For more details refer to

https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#now

avatar
New Contributor

@Shu Thank you so much. It works well.