Error 500 when adding expression

Hi,

I’m new to Grafana, and I’m having some problem with expression.

I’m fetching temperature data from AWS timestream, which works ok, using these queries:

SELECT * FROM "PartalaDB"."Lampotila_1" WHERE time > ago(24h) AND measure_name = 'temperature_282E4A96F0013C53'
SELECT * FROM "PartalaDB"."Lampotila_1" WHERE time > ago(24h) AND measure_name = 'temperature_2898C596F0013C42'

When I try to calculate temperature differential

 $A - $B

I get error 500.

Query data error
Object
status:500
statusText:"Internal Server Error"
data:Object
message:"Query data error"
traceID:"00000000000000000000000000000000"
config:Object
url:"api/ds/query"
method:"POST"
data:Object
requestId:"Q140"
retry:0
headers:Object
hideFromInspector:false
message:"Query error: 500 Internal Server Error"

What am I doing wrong? Temperature timestamps are identical.

And is there a way to rename datasets? Now they are

measure_value::double 1
measure_value::double 2

Grafana version 9.0.6-1, on Amazon EC2 Linux 2.

Edit: Got expression working by changing queries

SELECT time, measure_value::double FROM $__database.$__table WHERE time > ago(24h) AND measure_name = '$__measure'
1 Like

first, what version grafana are you on?

second:
you should also check out using Grafana’s built-in transformations, which can do a lot of powerful sql-like transforms. Just remember that all those get done on the frontend side so they are not nearly as performant :+1: