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
{{ message }}
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
Hi, we have a table consisting of a Timestamp and then many columns, each for a sensor, containing float values. We need to be able to select one of these sensors through a variable (this works fine) and then display a graph using the timestamps and the values from the selected column. To achieve that, I tried using "EXECUTE IMMEDIATE". It doesn't fail, but I do not get the data. Also, the schema object contains all columns from the source table, not the 2 I expected (timestamp and the values from the selected column). I also tried storing the result of the execute into a TEMP table, to no avail. Now I'm trying with a CTE, but in that case, it doesn't find the CTE's table name (fails with the typical "Invalid project ID..."). Are execute commands supported? If not, is anyone aware of an alternate way to do this?
Thanks a lot !
Example
WITH DataPoints (Time as TIMESTAMP, Metric as DECIMAL) as
EXECUTE IMMEDIATE "SELECT CAST(Start_Date AS TIMESTAMP) as time, CAST(J1_PV as DECIMAL) as metric FROM project.dataset.table WHERE $__timeFilter(CAST(Start_Date AS TIMESTAMP))";
SELECT * FROM DataPoints;
Results in:
"Invalid project ID 'DataPoints'. Project IDs must contain 6-63 lowercase letters, digits, or dashes. Some project IDs also include domain name separated by a colon. IDs must start with a letter and may not end with a dash."
Note: "J1_PV" is the name of one of the columns, it will be ultimately be replaced by a concatenation of the SELECT statement and the variable value. Kept outside this to simplify. Project/dataset/table were redacted.
Specifications
Version: 2.0.2
Platform: Ubuntu VM
Grafana Version: 8.1.3
The text was updated successfully, but these errors were encountered:
Hi, I ended up creating a view that would UNPIVOT the needed columns, and do a simple select from that view in the Grafana plugin. So I'm saved. But I'd still like to know if dynamic queries are supported or not. Cheers!
Hi @FMauroy, I am pretty sure it does not supported.
Sorry if its a naive question but why not simply use a nested query (like you ended up doing I guess)?
Hi, we have a table consisting of a Timestamp and then many columns, each for a sensor, containing float values. We need to be able to select one of these sensors through a variable (this works fine) and then display a graph using the timestamps and the values from the selected column. To achieve that, I tried using "EXECUTE IMMEDIATE". It doesn't fail, but I do not get the data. Also, the schema object contains all columns from the source table, not the 2 I expected (timestamp and the values from the selected column). I also tried storing the result of the execute into a TEMP table, to no avail. Now I'm trying with a CTE, but in that case, it doesn't find the CTE's table name (fails with the typical "Invalid project ID..."). Are execute commands supported? If not, is anyone aware of an alternate way to do this?
Thanks a lot !
Example
WITH DataPoints (Time as TIMESTAMP, Metric as DECIMAL) as
EXECUTE IMMEDIATE "SELECT CAST(
Start_Date
AS TIMESTAMP) as time, CAST(J1_PV
as DECIMAL) as metric FROMproject
.dataset
.table
WHERE $__timeFilter(CAST(Start_Date
AS TIMESTAMP))";SELECT * FROM DataPoints;
Results in:
"Invalid project ID 'DataPoints'. Project IDs must contain 6-63 lowercase letters, digits, or dashes. Some project IDs also include domain name separated by a colon. IDs must start with a letter and may not end with a dash."
Note: "J1_PV" is the name of one of the columns, it will be ultimately be replaced by a concatenation of the SELECT statement and the variable value. Kept outside this to simplify. Project/dataset/table were redacted.
Specifications
The text was updated successfully, but these errors were encountered: