- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How can I use variable on query of executeSQL processor on apache NiFi?
- Labels:
-
Apache NiFi
Created 02-26-2018 09:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created 02-26-2018 08:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created 02-27-2018 01:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Shu Thank you so much. It works well.
