Add support for parameter lists


I would love a feature where you can provide a list of parameters in redash e.g

WHERE city IN “{{paramter}}”

As of right now it doesn’t seem to work


I have been using a fun workaround :slight_smile: with Postgres arrays:

from paths
where id::varchar = any(string_to_array(replace(trim(’{{paths (enter comma separated path ids like 5,4,9)}}’), ’ ', ‘’), ‘,’))

The replace part is optional, in case you’re worried that people will enter comma space delimited values instead of comma delimited values.



Redash supports query based parameters.


It does.

#RTFM :slight_smile:


I am already using the filters and parameters.
My questions specifically targeted the IN SQL-Keyword, which didn’t work
with the standard parameters.


The option does not show for me in the parameters drop down list.
I used the newest Amazon image about 2 weeks ago. How can I
enable this maybe manually?


Building from source should work. Not sure of the sha from which image is built.


@rohithmenon Thanks for the quick reply. That is unfortunately not an option, since it is a production server and I’d actually prefer it to upgrade via the built in function. Is there an ETA for a new build?


Not sure. You should ping the maintainer. You can cherrypick the change on top of the current deploy if you want. But its all up to you.


@rohithmenon Never heard of that option before. Can you elaborate?


Cherry picking will require rebuilding the frontend code…

The next release should be this month.


Perfect! Thanks @arikfr

We have our private fork of redash for unreleased features. If you are not comfortable with building from source, what I told is not an option.


+1 for parameter lists. One way I could see it being implemented is as follows:
New parameter type: text list
Text box appears for entry of the list - one value per line
Redash wraps each line in single quotes and adds a comma
Parameter can be used in SQL like so: WHERE id in( {{ id_list }} )

Similar implementation for number list except no quotes around the values when being inserted into the query. You could also implement as a single new parameter type “list” and add a checkbox for text vs number.


One workaround for this issue is using Jinja2’s loop.last syntax. The Jinja code would look something like this:

  {% for item in this_list %}
  {{ item }} {% if not loop.last %} , {% endif %}
  {% endfor %}

This avoids the syntax error of a trailing comma without hacking through Python’s tuple representations.



Just to make sure I understand, are you saying this is a workaround to make it work under the current version of Redash? I wasn’t aware that you could write inline Jinja in a query. I just Googled “redash jinja” and didn’t come up with any results, so if that’s what you’re saying, it must be an undocumented feature?