首页 > 解决方案 > 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'

标签: influxdbinfluxdb-python

解决方案


如果要将精度设置为秒

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

成功了。


推荐阅读