InfluxDB where 查询标签值
我正在尝试在 InfluxDB 上编写一个 where 子句,其中的点通过其键值进行过滤。
我的点包含字段 ping_to_google.com
和标签键 user
,其中用户可以是 raspi-2
或 raspi-5.这是数据库的示例输出:
> select * from networks where time > now()-1h
name: networks
time ping_to_google.com user
---- ------------------ ----
1645494054000000000 3.528 raspi-2
1645494078000000000 3.578 raspi-2
我正在使用 InfluxDB 版本 1.8 和 InfluxDB shell 版本 1.6.4
I am trying to write a where clause on InfluxDB where the points are filtered via their key values.
My points have the field ping_to_google.com
and the tag key user
where user can be raspi-2
or raspi-5
. This is a sample output of the database:
> select * from networks where time > now()-1h
name: networks
time ping_to_google.com user
---- ------------------ ----
1645494054000000000 3.528 raspi-2
1645494078000000000 3.578 raspi-2
I am using InfluxDB version 1.8 and InfluxDB shell version 1.6.4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个查询会起作用!
根据 influxDB 的文档,您应该仅单个 qoute 标记值:
Tags
tag_key; ['tag_value']
WHERE 子句中的单引号标记值。使用不带引号的标记值或双引号标记值的查询将不会返回任何数据,并且在大多数情况下不会返回错误。
他们没有指定如何编写标签键。令人疯狂的是,数据库在大多数情况下不会产生任何错误。另外,尚不清楚(在阅读本文档后非常意外)标签键应该是双引号的。但这是有效的,并且是如何做到的!
This query will work!
According to the documentation of the influxDB you should only single qoute tag values:
Tags
tag_key <operator> ['tag_value']
Single quote tag values in the WHERE clause. Queries with unquoted tag values or double quoted tag values will not return any data and, in most cases, will not return an error.
They don't specify how to write tag keys. It is crazy that the database does not produce any errors in most cases. Also, it's not clear (and very unexpected after reading this documentation) that the tag key should be double-qouted. But this works and is how to do it!