10000 Added chunk size parameter · thinkUpRoger/influxdb-python@7dddb0b · GitHub
[go: up one dir, main page]

Skip to content

Commit 7dddb0b

Browse files
author
Panos
committed
Added chunk size parameter
1 parent 49698fc commit 7dddb0b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

influxdb/client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ def query(self,
308308
expected_response_code=200,
309309
database=None,
310310
raise_errors=True,
311-
chunked=False):
311+
chunked=False,
312+
chunk_size=0):
312313
"""Send a query to InfluxDB.
313314
314315
:param query: the actual query string
@@ -333,6 +334,9 @@ def query(self,
333334
is returned as opposed to a list.
334335
:type chunked: bool
335336
337+
:param chunk_size: Size of each chunk to tell InfluxDB to use.
338+
:type chunk_size: int
339+
336340
:returns: the queried data
337341
:rtype: :class:`~.ResultSet`
338342
"""
@@ -355,6 +359,8 @@ def query(self,
355359

356360
if chunked or 'chunked' in params:
357361
params['chunked'] = 'true'
362+
if chunk_size > 0:
363+
params['chunk_size'] = chunk_size
358364
return self._read_chunked_response(response)
359365

360366
data = response.json()

influxdb/tests/client_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ def test_chunked_response(self):
813813
text=example_response
814814
)
815815
response = list(self.cli.query('show series limit 4 offset 0',
816-
chunked=True))
816+
chunked=True, chunk_size=4))
817817
self.assertTrue(len(response) == 4)
818818
self.assertEqual(response[0].raw, ResultSet(
819819
{"statement_id": 0,

0 commit comments

Comments
 (0)
0