Wojtas.Zet
Wojtas.Zet

Reputation: 816

python influxdbclient - how to set precision to seconds?

I am writing data point to influxdb database, for grafana to display. I have source datapoint time in epoch seconds.

Grafana displays the point, but the time on the graph is set as 1970. I suspect its the problem with precision cause grafana uses nanoseconds by default. I tried setting the precision as seconds with

from influxdb import InfluxDBClient


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

but it yields error:

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

Upvotes: 0

Views: 2475

Answers (1)

Wojtas.Zet
Wojtas.Zet

Reputation: 816

If you want to set precision to seconds

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

does the trick.

Upvotes: 2

Related Questions