如何将两个表的_value合并到一个表中?
我正在尝试创建一个仪表板,可以在其中按加油站位置和燃料类型过滤数据。 这是我的查询表:
from(bucket: "homeassistant")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["entity_id"] == "tankerkoenig_aral_tankstelle_bat_waldmohr_e5")
|> filter(fn: (r) => r["_field"] == "city_str" or r["_field"] == "value")
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> yield(name: "last")
我怎样才能获得 _field "city_str 的 _value " 和 _field "value" 的 _value 放入一张表中,以便我可以在 grafana 中同时查询位置和价格?
I'm trying to create a dashboard where i can filter data by gas station location and fuel type.
This is my Table from this query:
from(bucket: "homeassistant")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["entity_id"] == "tankerkoenig_aral_tankstelle_bat_waldmohr_e5")
|> filter(fn: (r) => r["_field"] == "city_str" or r["_field"] == "value")
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> yield(name: "last")
How can i get the _value of _field "city_str" and the _value of the _field "value" into one table so i can query the location and the price at the same time within grafana?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 schema.fieldsAsCols 函数。您将得到一张包含
city_str
和value
列的表。Use schema.fieldsAsCols function. You will get one table with
city_str
andvalue
columns.