You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I've been trying for a long time to make setup a variable whose query depends on another variable and couldn't. The only explanation I have is that there is a bug somewhere.
This is my table
CREATETABLEIF NOT EXISTS ao_pricing.data (
model_instrument uuid,
maturity bigint,
as_of timestamp,
label ascii static,
pricer_data pricer_data_t,
fitter_data fitter_data_t,
PRIMARY KEY ((model_instrument, maturity), as_of)
) WITH CLUSTERING ORDER BY (as_of DESC);
Please notice I have a partition key which is composed of two keys: model_instrument and maturity. My temporal variable is: as_of.
Now I want to show in Grafana graphs that depend on the pair (model_instrument, maturity) which must be selectable through a dropdown and this would be my parameter for the queries.
There are multiple problems with this. First is that I don't know how to return a pair or tuple for variables. The ideal query to get all the parameter values would be:
cqlsh> SELECT DISTINCT model_instrument, maturity, label FROM ao_pricing.data;
model_instrument | maturity | label
--------------------------------------+---------------------+-----------------------------
e971637a-9454-11e1-a34e-15ebadefba03 | 1704472200000000000 | INGA 2024-01-05
ea14f940-9454-11e1-a34e-15ebadefba03 | 1704472200000000000 | RDSA 2024-01-05
e9a7721c-9454-11e1-a34e-15ebadefba03 | 1718983800000000000 | VOW 2024-06-21
e971637a-9454-11e1-a34e-15ebadefba03 | 1710520200000000000 | INGA 2024-03-15
e95fa338-9454-11e1-a34e-15ebadefba03 | 1718983800000000000 | BAS 2024-06-21
e95fa338-9454-11e1-a34e-15ebadefba03 | 1726846200000000000 | BAS 2024-09-20
Now if I define a variable, it expects to get two columns: one is the value and one is the text. My query would return 3, I can't make the value a pair or tuple. I came up with a work around leveraging the functions from ScyllaDB (let me know if you have a better solution for this):
CREATE OR REPLACEFUNCTIONao_pricing.pair_to_key(a ascii, b ascii)
RETURNS NULLONNULL INPUT
RETURNS ascii
LANGUAGE LUA
AS'return a.."|"..b;';
So I changed and now I have two variables, first query is be the following (products):
SELECT DISTINCT pair_to_key(pair_to_key(CAST(model_instrument AS ascii), CAST(maturity AS ascii)), label) FROMao_pricing.data;
and second query is:
SELECT DISTINCT pair_to_key(pair_to_key(CAST(model_instrument AS ascii), CAST(maturity AS ascii)), label) FROMao_pricing.dataWHERE model_instrument = $products ALLOW FILTERING;
But this does not work, I always get an error: Error updating options: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data.
Do you have a solution: I can either keep the two variables separated OR I can keep one variable but in that case I need to extract the first part of the concatenation (and this seems to be impossible to do in Grafana).
The text was updated successfully, but these errors were encountered:
Hi, @barsdeveloper !
Thank you for your report. It is true that dependant variables are not supported by the datasource yet.
I believe that in your case there is no other way than to use separated variables.
@HadesArchitect It is the subject to research. I am sure there is a way since the prometheus datasource support template variables. I believe it has to be done somewhere in plugins frontend, because backend resolves variables independently. Probable, it would be better to look into existing plugins(e.g. prometheus) first.
Hello, I've been trying for a long time to make setup a variable whose query depends on another variable and couldn't. The only explanation I have is that there is a bug somewhere.
This is my table
Please notice I have a partition key which is composed of two keys: model_instrument and maturity. My temporal variable is: as_of.
Now I want to show in Grafana graphs that depend on the pair (model_instrument, maturity) which must be selectable through a dropdown and this would be my parameter for the queries.
There are multiple problems with this. First is that I don't know how to return a pair or tuple for variables. The ideal query to get all the parameter values would be:
It returns results like this:
Now if I define a variable, it expects to get two columns: one is the value and one is the text. My query would return 3, I can't make the value a pair or tuple. I came up with a work around leveraging the functions from ScyllaDB (let me know if you have a better solution for this):
So I changed and now I have two variables, first query is be the following (products):
and second query is:
But this does not work, I always get an error: Error updating options: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data.
Do you have a solution: I can either keep the two variables separated OR I can keep one variable but in that case I need to extract the first part of the concatenation (and this seems to be impossible to do in Grafana).
The text was updated successfully, but these errors were encountered: