0

In Grafana, I use AWS Timestream as data source. And I want to show only specific time range such as 9:00 to 21:00. AWS Timestream supports SQL so I write like this.

SELECT *
FROM testDB.testTable
WHERE measure_name = 'test'
AND time BETWEEN time('09:00:00') AND time('21:00:00')
ORDER BY time DESC LIMIT 10080

But I got the following error. Could you tell me what is wrong with it?

ValidationException: line 4:18: Problems with function : time. Either the function does not exist, or there is a problem with a dependent function

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59
Ryo Matsuzaka
  • 135
  • 1
  • 1
  • 9

1 Answers1

1
SELECT *
FROM testDB.testTable
WHERE measure_name = 'test'
AND hour(time) BETWEEN 9 AND 20
ORDER BY time DESC LIMIT 10080

The above query will fetch records which hours are between '09:00:00.000000000' and '20:59:59.999999999'

Juanchi Rios
  • 119
  • 6