我已经在QuestDB中导入了一个演示数据集,可以从控制台成功查询到它。我正在使用Grafana构建一个仪表板来测试可视化。
我的QuestDB安装在9000端口上运行,我可以导入它而不会出现任何问题:
curl -F data=@weather.csv http://localhost:9000/imp我正在运行以下查询,但该查询失败:
SELECT timestamp as time,
avg(visMiles) AS average_visibility
FROM 'weather.csv'
WHERE $__timeFilter(timestamp)
SAMPLE BY $__interval
LIMIT 1000我得到的错误是
pq: unknown function name: between(TIMESTAMP,STRING,STRING)我正在使用他们的examples中提供的数据集。
发布于 2021-01-07 18:49:35
QuestDB依赖于在创建表期间指定的时间戳。如果提供了curl请求作为URL参数,这不会导致错误,给定名为‘timestamp’的列:
curl -F data=@weather.csv http://localhost:9000/imp?timestamp=timestamp另一种选择是在SELECT操作期间,timestamp()函数可以动态指定一个。如果您使用curl导入,但没有设置指定的时间戳,则有两种选择:
timestamp():选择timestamp as time,avg(visMiles) AS average_visibility FROM (‘weather.csv’timestamp(timestamp)) WHERE $__timeFilter(timestamp) SAMPLE BY $__interval LIMIT 1000
ORDER BY是因为演示数据集具有无序的时间戳条目:create table temp_table as (select * from‘order by timestamp) timestamp(timestamp);
使用temp_table,而不是查询原始数据集:
选择timestamp as time,avg(visMiles) AS average_visibility FROM temp_table WHERE $__timeFilter(timestamp) SAMPLE BY $__interval LIMIT 1000
如果您需要有关使用指定时间戳的更多信息,QuestDB concepts / timestamp docs页面提供了更多详细信息。
编辑:这个主题还有更多的资源,比如guide for Grafana with QuestDB和GitHub repo with docker-compose。
https://stackoverflow.com/questions/65610034
复制相似问题