【问题标题】:How to escape single quotes in influxDB query如何在 influxDB 查询中转义单引号
【发布时间】:2020-01-13 19:26:55
【问题描述】:

我正在尝试使用来自 cli 的 -execute 在 influxDB 上运行命令

influx -execute 'select * from test_measurement where time > \‘2020-01-13T16:22:00Z\’ and time < \‘2020-01-13T16:22:30Z\’ -username uname -password pwd 

查询没有运行,因为我无法为时间条件转义单引号(')。有人可以帮忙看看语法吗。

【问题讨论】:

    标签: influxdb influxql


    【解决方案1】:

    你可以试试:

    influx -execute "select * from test_measurement where time > '2020-01-13T16:22:00Z' and time < '2020-01-13T16:22:30Z'" -username uname -password pwd 
    

    【讨论】:

      【解决方案2】:

      时间>'日期字符串'

      在 influx cli 中不起作用,因为这不是字符串字段的有效运算符...我认为您想要一个纳秒形式的数值或任何您的数据库实例的精度。

      对于字符串字段,可以使用正则表达式匹配

      =~ /2020-01-*/

      例如,对于 2020 年 1 月的所有比赛。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-11-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-03
        • 2016-03-16
        相关资源
        最近更新 更多