Problem with parameters in QL-chart and MySQL
ktselishev opened this issue · 1 comments
ktselishev commented
- I have a MySQL database as a source for a QL-chart.
- I have a parameter (string) that can have one or multiple values.
- According to the documentation, “If the query contains the IN operator before a parameter, the substituted value is always converted into a tuple. Such a query will work correctly if you select one or more values.”
- However, when I use only one value, it doesn’t work as expected — the value is not converted into a tuple and remains a string.
artemipanchuk commented
Hello ktselishev,
Thanks for your issue and sorry for the inconvinience.
According to the documentation, “If the query contains the IN operator before a parameter, the substituted value is always converted into a tuple. Such a query will work correctly if you select one or more values.”
In fact this is the issue. These rules apply only for ClickHouse and PostgreSQL connections. We will update the documentation soon.
Workaround for MySQL can be:
SELECT * FROM users WHERE name IN {{name}}
And if you need to use only one value in name, you may fill name with this value twice.