How do I set a variable in an Impala query using HUE?

Viewed 5503

I need to add parameters in several locations in a long query. I want to use parameters because I need to run the query multiple times with different values substituted in. This is very cumbersome because I need to replace the text in all locations whenever I need to change my filter criteria. Is there a way to set a variable in Impala via HUE?

Initial research indicates that this is possible when working with the impala-shell but for HUE, I've found nothing.

2 Answers

You can set variables in Impala via HUE as you can see in the following picture

enter image description here

You can also use this script. Here type of variables int and date. Also can define a default value.

SELECT id, fullname, birthdate 
FROM db.scientists
WHERE id <= ${id=2} 
AND to_date(birthdate) BETWEEN '${mindate=1900-01-01}' AND '${maxdate=2000-01-01}'   

enter image description here

Related