Timestamp 如何在grafana中将字符串时间戳列转换为时间戳
我在grafana中使用vertica的PG插件,因为grafana没有本地vertica插件Timestamp 如何在grafana中将字符串时间戳列转换为时间戳,timestamp,grafana,vertica,Timestamp,Grafana,Vertica,我在grafana中使用vertica的PG插件,因为grafana没有本地vertica插件 select date_trunc('hour', moment) as time, sum(netSlaes) as netSales from ba.table group by time; 格拉法纳说: Invalid type for column time, must be of type timestamp or unix timestamp, g
select date_trunc('hour', moment) as time,
sum(netSlaes) as netSales
from ba.table
group by time;
格拉法纳说:
Invalid type for column time, must be of type timestamp or unix timestamp, got: string 2019-05-28 22:00:00
但当我使用DataGrip时,此sql返回:
2019-05-28 05:00:00.000000 1456106.03030303
2019-05-28 11:00:00.000000 16463313.9090909
2019-05-28 13:00:00.000000 15796558.4818182
2019-05-28 14:00:00.000000 5134891.6969697
2019-05-28 20:00:00.000000 13058329.5909091
...
请帮助了解时间列的时间戳格式尝试使用
DATE\u部分
从列中提取unix时间戳(epoch),并将其强制转换为INT
select date_part('EPOCH', date_trunc('hour', moment))::INT as time,
sum(netSlaes) as netSales
from ba.table
group by time;
附注-
过去我曾试图让PG Grafana的插件与Vertica一起使用,但也遇到过类似的数据类型问题。如果我没记错的话,被认为是字符串的整数有问题。vertica开发人员为grafana添加了插件:
大约4个月前我基于vertica类型的lib pq制作了适配器,但grafana使用xorm,我也必须修补xorm。。。所以明天我将尝试为vertica编写插件