-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'opt.value.match is not a function' error when using array variable. #169
Comments
@ryanmickler unfortunately, grafana 7.x broke template variables for cases when the data source plugin return each variable value as as a workaround, we can use |
# 2.0.2 (2020-07-07) ## Enhancements: * add alerts support for Windows and MacOSX * improve ad-hoc filters for query field values as `SELECT DISTINCT field AS value FROM db.table LIMIT 300`, Altinity/clickhouse-grafana#222 * add the ability to multiple JOIN parsing Altinity/clickhouse-grafana#206 * multiple improvements for docker-compose environments, add automatic dashboards and data source provisions which help to reproduce most of the corner cases which happens in Grafana + ClickHouse ## Fixes: * apply a workaround for UTC timezone for Date and DateTime columns in grafana dashboards Altinity/clickhouse-grafana#117 * clear documentation about timestamp term for $from and $to Altinity/clickhouse-grafana#115 * fix AST parsing corner case in `WHERE [test, 'test']` "," was skipped, fix ah-doc AST FROM recursive parsing Altinity/clickhouse-grafana#99 * fix corner cases for table functions parsing when Adhoc filter applied Altinity/clickhouse-grafana#130 * fix multiple grammar issues in README.md * fix convert rules for Float, Decimal columns from Clickhouse to Grafana Table plugin Altinity/clickhouse-grafana#199 * fix corner cases when Grafana Template variable value represented as an array of strings Altinity/clickhouse-grafana#169 * fix AST parsing corner cases for $macroFunctions correct position for FROM statement Altinity/clickhouse-grafana#187 Signed-off-by: Eugene Klimov <eklimov@altinity.com>
https://github.com/Vertamedia/clickhouse-grafana/blob/50d46ef5138f5b5d8098c1cbacc7f0d3f56e16a9/src/sql_query.ts#L548
I'm getting an error when trying to use an array variable.
My variable is called
modcha
and is aquery
variable, set up as follows.SELECT DISTINCT [Module, Channel] FROM mydb.my_table
This works fine, and see the variables getting correctly populated
[0,1], [1,1], [2,0],...
However, in the visualization, im trying to use:
... WHERE [Module, Channel] == [ $modcha ] ...
And I get the error
opt.value.match is not a function
Using grafana v6.2.5, and installing clickhouse plugin from the cli
grafana-cli plugins install vertamedia-clickhouse-datasource
UPDATE:
there's even more crazy stuff going on. if I write
... WHERE [Module, Channel] == ${modcha:json} ...
i no longer get the
opt.value.match
error, however the generated SQL isWHERE [Module, Channel] == [[1,0],[1,1],[2,0],[2,1],[3,0],[3,1],[4,0],[4,1],[5,0],[5,1],[6,0],[6,1],[7,0],[7,1],[8,0],[8,1]]
i.e. its not using an element, but the whole list of
modcha
values.UPDATE UPDATE:
found a problem. I had enabled the
All
option for my variable, hence i was seeing the whole list. Disabling theAll
option fixed that.I got this to work as i wanted:
... WHERE [Module, Channel] == [${modcha:csv}] ...
The text was updated successfully, but these errors were encountered: