Skip to content

Commit cd28c36

Browse files
author
aviau
committed
Merge influxdata#92 (Thanks @timtroendle!)
Marked write_points_with_precision deprecated
2 parents 9e363dc + 94400bd commit cd28c36

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

influxdb/client.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import json
66
import socket
77
import requests
8+
import warnings
89

910
from influxdb import chunked_json
1011

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

169-
def write_points(self, data, *args, **kwargs):
170+
def write_points(self, data, time_precision='s', *args, **kwargs):
170171
"""
171172
write_points()
172173
@@ -198,19 +199,27 @@ def list_chunks(l, n):
198199
"name": name,
199200
"columns": columns
200201
}]
201-
time_precision = kwargs.get('time_precision', 's')
202-
self.write_points_with_precision(
202+
self._write_points(
203203
data=item,
204204
time_precision=time_precision)
205205

206206
return True
207207

208-
return self.write_points_with_precision(data, *args, **kwargs)
208+
return self._write_points(data=data, time_precision=time_precision)
209209

210210
def write_points_with_precision(self, data, time_precision='s'):
211211
"""
212-
Write to multiple time series names
212+
DEPRECATED. Write to multiple time series names
213+
213214
"""
215+
warnings.warn(
216+
"write_points_with_precision is deprecated, and will be removed "
217+
"in future versions. Please use "
218+
"``InfluxDBClient.write_points(time_precision='..')`` instead.",
219+
FutureWarning)
220+
return self._write_points(data=data, time_precision=time_precision)
221+
222+
def _write_points(self, data, time_precision):
214223
if time_precision not in ['s', 'm', 'ms', 'u']:
215224
raise Exception(
216225
"Invalid time precision is given. (use 's', 'm', 'ms' or 'u')")

influxdb/misc.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Miscellaneous
44
"""
55
import math
6+
import warnings
67

78
from .client import InfluxDBClient
89

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

5556
def write_points_with_precision(self, data, time_precision='s'):
5657
"""
57-
Write to multiple time series names
58+
DEPRECATED. Write to multiple time series names
59+
5860
"""
61+
warnings.warn(
62+
"write_points_with_precision is deprecated, and will be removed "
63+
"in future versions. Please use "
64+
"``DataFrameClient.write_points(time_precision='..')`` instead.",
65+
FutureWarning)
5966
return self.write_points(data, time_precision='s')
6067

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

0 commit comments

Comments
 (0)