python influxdbclient-如何将精度设置为秒?

问题描述

我正在将数据点写入influxdb数据库,以供grafana显示。 我在纪元秒内就有源数据点time

Grafana显示了该点,但是图形上的时间设置为1970。我怀疑它的精度问题,因为grafana认使用纳秒。 我尝试使用

将精度设置为秒
from influxdb import InfluxDBClient


client.write_points(entry,params={'epoch': 's'})

但是会产生错误

  client.write_points(entry,params={'epoch': 's'})
TypeError: write_points() got an unexpected keyword argument 'params'

解决方法

如果要将精度设置为秒

client.write_points(entry,time_precision='s')

起到了作用。