influxdb - Influx CLI 执行在 WHERE 子句中找不到标签
问题描述
我有一个系列,里面有一些标签
> 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'
它返回预期的结果。
现在,当我尝试使用 Influx CLI 使用-execute
命令运行相同的查询时,它什么也不返回。
这是我正在使用的 CLI 命令。我没有抛出错误,它什么也不返回。我是否以错误的方式编写查询?我曾尝试在 house_tag 标签中使用双引号,但它不起作用。当我删除“house_tag”部分时,查询会运行(当然,我想查看的不仅仅是 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
推荐阅读
- intellij-idea - 来自 ID(intellij) 的 JAvaFX 模块化worksnonmodular:错误:JavaFX 运行时组件丢失,并且是运行此应用程序所必需的
- c# - 具有自定义功能的多级循环
- python - 将N个数字提取到Python中的新列中
- javascript - Azure Function 中的 npm themeparks 模块中的“无法创建第二个实例”错误
- python - 提取特定单元格的值并将其填充以代替 pyspark 数据框中的 NA 值
- nginx - Nginx 导致访问Adminer SQL web 管理员出现问题
- reactjs - 如何从纱线工作区中删除 CRA?
- html - 边缘 - 无法水平和垂直居中文本
- c# - 任务执行
- git - 如何压缩包含合并提交的提交