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

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

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

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

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

Super 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

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

New Contributor

@Shu Thank you so much. It works well.