我需要在InfluxDB查询中使用反斜杠字符。我可以将点写入数据库,但无法读取。
我应该如何在标签值中编写包含反斜杠\的查询?
这是代码示例(使用influxdb-5.2.3软件包):
#!/usr/bin/python3
from influxdb import InfluxDBClient
client = InfluxDBClient('influxdb', 8086)
client.switch_database('test')
points = [{"measurement": "mytest",
"tags": {"mytag": "x"},
"fields": {"value": "foo"}
}]
client.write_points(points)
# Here's the problem
res = client.query("SELECT * FROM mytest WHERE mytag=$tag",
bind_params={"tag": "\\"})
# Prints [] :-(
print(list(res.get_points()))