何とかInfluxDBの値としてリストを挿入できますか?これはJSONです:Influxdbでリストを値として挿入
json_body = [
{
"measurement":"devices",
"tags":{
"host":"server01",
"region":"us-west"
},
"fields": {
"device":1234,
"coord":[60.177751,24.913778],
"local":[[244,5,'232E','F27B',23],[244,5,'232F','76FE',9]]
}
}
]
代替リストの文字列表現を使用することですが、その後、私はそれが正常に動作され、以下のように一覧表示するには変換する必要があります。ここで
ast.literal_eval(device_points [0] [ 'ローカル'])
は、文字列表現でJSONオブジェクトです:
json_body = [
{
"measurement":"devices",
"tags":{
"host":"server01",
"region":"us-west"
},
"fields": {
"device":1234,
"coord":"[60.177751,24.913778]",
"local":"[[244,5,'232E','F27B',23],[244,5,'232F','76FE',9]]"
}
}
]
client.write_points(json_body)
query = 'select local from devices;'
print("Queying data: " + query)
result = client.query(query)
device_points = list(result.get_points(measurement='devices'))
は書き込みを達成するために他のいくつかの方法がありますリストの直接?
ありがとうございます!