Influx CLI execute 在 WHERE 子句中找不到标签

Influx CLI execute does not find tags in the WHERE clause

我有一个系列,里面有一些标签

> show tag keys on telegraf from mqtt_consumer
name: mqtt_consumer
tagKey
------
host
house_tag
sensorId
topic

并且我使用的是在 influx 命令行中正常运行的正常查询

select time,value,sensorId,house_tag from mqtt_consumer where time>now()-10m and house_tag='houseG1'

returns 预期结果。

现在,当我使用 -execute 命令尝试 运行 使用 Influx CLI 进行相同的查询时,它 returns 什么都没有。

这是我正在使用的 CLI 命令。我没有抛出错误,它只是 returns 什么都没有。我是否以错误的方式编写查询?我试过在 house_tag 标签中使用双引号,但没有用。当我删除 "house_tag" 部分时,查询 运行s (当然我想看到的不仅仅是 house_tags)

sudo influx -username user -password "password" -database 'database' -host 'localhost' -execute 'select time,value,sensorId,house_tag from mqtt_consumer where time>now()-1d and house_tag='houseG1'' -format 'csv'

您的查询不是 运行 的原因是您没有在 -execute 语句中组合双引号 " 和单引号 '

尝试运行以下查询:

sudo influx -username user -password "password" -database 'database' -host 'localhost' -execute "select time,value,sensorId,house_tag from mqtt_consumer where time>now()-1d and house_tag='houseG1'" -format csv