Harshit Vijayvargia
Harshit Vijayvargia

Reputation: 225

How to use $timeFilter in grafana with sql ? It is showing undefined in generated sql

I am trying to use the $timeFilter variable in grafana with clickhouse as my database. The query I am writing is this :

select timestamp from pw.lte_avail_key where $timeFilter

The Generated SQL by Grafana is this:

select timestamp from pw.lte_avail_key where undefined >= toDateTime(1615514208)

In some panels, the query being generated is this:

select timestamp from pw.lte_avail_key where timestamp >= toDateTime(1615514208)

Why is this random issue occuring? Please help.

Upvotes: 1

Views: 10777

Answers (1)

vladimir
vladimir

Reputation: 15226

Look at the doc:

$timeFilter - replaced with currently selected "Time Range". Requires Column:Date and Column:DateTime or Column:TimeStamp to be selected.

Make sure you define the Column:Date and Column:DateTime:

enter image description here

Upvotes: 2

Related Questions