Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Marked write_points_with_precision deprecated #92

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions influxdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import socket
import requests
import warnings

from influxdb import chunked_json

Expand Down Expand Up @@ -166,7 +167,7 @@ def request(self, url, method='GET', params=None, data=None,
# by doing a POST to /db/foo_production/series?u=some_user&p=some_password
# with a JSON body of points.

def write_points(self, data, *args, **kwargs):
def write_points(self, data, time_precision='s', *args, **kwargs):
"""
write_points()

Expand Down Expand Up @@ -198,19 +199,27 @@ def list_chunks(l, n):
"name": name,
"columns": columns
}]
time_precision = kwargs.get('time_precision', 's')
self.write_points_with_precision(
self._write_points(
data=item,
time_precision=time_precision)

return True

return self.write_points_with_precision(data, *args, **kwargs)
return self._write_points(data=data, time_precision=time_precision)

def write_points_with_precision(self, data, time_precision='s'):
"""
Write to multiple time series names
DEPRECATED. Write to multiple time series names

"""
warnings.warn(
"write_points_with_precision is deprecated, and will be removed "
"in future versions. Please use "
"``InfluxDBClient.write_points(time_precision='..')`` instead.",
FutureWarning)
return self._write_points(data=data, time_precision=time_precision)

def _write_points(self, data, time_precision):
if time_precision not in ['s', 'm', 'ms', 'u']:
raise Exception(
"Invalid time precision is given. (use 's', 'm', 'ms' or 'u')")
Expand Down
9 changes: 8 additions & 1 deletion influxdb/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Miscellaneous
"""
import math
import warnings

from .client import InfluxDBClient

Expand Down Expand Up @@ -54,8 +55,14 @@ def write_points(self, data, *args, **kwargs):

def write_points_with_precision(self, data, time_precision='s'):
"""
Write to multiple time series names
DEPRECATED. Write to multiple time series names

"""
warnings.warn(
"write_points_with_precision is deprecated, and will be removed "
"in future versions. Please use "
"``DataFrameClient.write_points(time_precision='..')`` instead.",
FutureWarning)
return self.write_points(data, time_precision='s')

def query(self, query, time_precision='s', chunked=False):
Expand Down