在数据库之间传输数据 - 涌入-python

时间:2016-01-05 08:23:12

标签: python influxdb

我正在尝试将从一个数据库中获取的点写入另一个数据库(Influxdb-python),我创建了一个dict列表,并且我使用了write_points(' dicts列表')。我甚至试图通过只获得2分来简化事情。

这是我的代码和错误,请帮忙

rs = cli.query("""SELECT * FROM cpu_value WHERE time > now() - 2s""")
points = rs.get_points()
a=next(points)
b=next(points)
temp=[]
temp.append(a)
temp.append(b)

client = InfluxDBClient(database='test')

client.write_points(temp)

enter image description here

1 个答案:

答案 0 :(得分:0)

使用INTO clause从一个数据库写入另一个数据库更容易,而不是通过外部库导出和导入点。

相关问题