如何使用 sql 在 grafana 中使用 $timeFilter ?它在生成的 sql

问题描述

我试图在 grafana 中使用 $timeFilter 变量,并将 clickhouse 作为我的数据库。 我正在写的查询是这样的:

从 pw.lte_avail_key 中选择时间戳,其中 $timeFilter

Grafana 生成sql 是这样的:

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

在某些面板中,生成查询是这样的:

从 pw.lte_avail_key 中选择时间戳,其中时间戳 >= toDateTime(1615514208)

为什么会出现这个随机问题?请帮忙。

解决方法

看看 doc

$timeFilter - 替换为当前选择的“时间范围”。需要 要选择的列:日期和列:日期时间或列:时间戳。

确保您定义了 Column:DateColumn:DateTime:

enter image description here