Skip to content

Commit 59e233b

Browse files
committed
Remove get_list_series
SHOW SERIES returns data in line format since 0.11 and the current functionality is broken. We have to implement a proper line format parser before we can reintroduce this functionality.
1 parent bc456b3 commit 59e233b

File tree

5 files changed

+0
-150
lines changed

5 files changed

+0
-150
lines changed

influxdb/_dataframe_client.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,6 @@ def query(self, query, chunked=False, database=None):
9090
else:
9191
return results
9292

93-
def get_list_series(self, database=None):
94-
"""
95-
Get the list of series, in DataFrame
96-
97-
"""
98-
results = super(DataFrameClient, self)\
99-
.query("SHOW SERIES", database=database)
100-
if len(results):
101-
return dict(
102-
(key[0], pd.DataFrame(data)) for key, data in results.items()
103-
)
104-
else:
105-
return {}
106-
10793
def _to_dataframe(self, rs):
10894
result = {}
10995
if isinstance(rs, list):

influxdb/client.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -588,35 +588,6 @@ def get_list_retention_policies(self, database=None):
588588
)
589589
return list(rsp.get_points())
590590

591-
def get_list_series(self, database=None):
592-
"""Get the list of series for a database.
593-
594-
:param database: the name of the database, defaults to the client's
595-
current database
596-
:type database: str
597-
:returns: all series in the specified database
598-
:rtype: list of dictionaries
599-
600-
:Example:
601-
602-
>> series = client.get_list_series('my_database')
603-
>> series
604-
[{'name': u'cpu_usage',
605-
'tags': [{u'_id': 1,
606-
u'host': u'server01',
607-
u'region': u'us-west'}]}]
608-
"""
609-
rsp = self.query("SHOW SERIES", database=database)
610-
series = []
611-
for serie in rsp.items():
612-
series.append(
613-
{
614-
"name": serie[0][0],
615-
"tags": list(serie[1])
616-
}
617-
)
618-
return series
619-
620591
def get_list_servers(self):
621592
"""Get the list of servers in InfluxDB cluster.
622593

influxdb/tests/client_test.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -517,27 +517,6 @@ def test_get_list_servers_fails(self):
517517
with _mocked_session(cli, 'get', 401):
518518
cli.get_list_servers()
519519

520-
def test_get_list_series(self):
521-
example_response = \
522-
'{"results": [{"series": [{"name": "cpu_load_short", "columns": ' \
523-
'["_id", "host", "region"], "values": ' \
524-
'[[1, "server01", "us-west"]]}]}]}'
525-
526-
with requests_mock.Mocker() as m:
527-
m.register_uri(
528-
requests_mock.GET,
529-
"http://localhost:8086/query",
530-
text=example_response
531-
)
532-
533-
self.assertListEqual(
534-
self.cli.get_list_series(),
535-
[{'name': 'cpu_load_short',
536-
'tags': [
537-
{'host': 'server01', '_id': 1, 'region': 'us-west'}
538-
]}]
539-
)
540-
541520
def test_create_retention_policy_default(self):
542521
example_response = '{"results":[{}]}'
543522

influxdb/tests/dataframe_client_test.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -301,49 +301,6 @@ def test_query_with_empty_result(self):
301301
result = cli.query('select column_one from foo;')
302302
self.assertEqual(result, {})
303303

304-
def test_list_series(self):
305-
response = {
306-
'results': [
307-
{'series': [
308-
{
309-
'columns': ['host'],
310-
'measurement': 'cpu',
311-
'values': [
312-
['server01']]
313-
},
314-
{
315-
'columns': [
316-
'host',
317-
'region'
318-
],
319-
'measurement': 'network',
320-
'values': [
321-
[
322-
'server01',
323-
'us-west'
324-
],
325-
[
326-
'server01',
327-
'us-east'
328-
]
329-
]
330-
}
331-
]}
332-
]
333-
}
334-
335-
expected = {
336-
'cpu': pd.DataFrame([['server01']], columns=['host']),
337-
'network': pd.DataFrame(
338-
[['server01', 'us-west'], ['server01', 'us-east']],
339-
columns=['host', 'region'])}
340-
341-
cli = DataFrameClient('host', 8086, 'username', 'password', 'db')
342-
with _mocked_session(cli, 'GET', 200, response):
343-
series = cli.get_list_series()
344-
assert_frame_equal(series['cpu'], expected['cpu'])
345-
assert_frame_equal(series['network'], expected['network'])
346-
347304
def test_get_list_database(self):
348305
data = {'results': [
349306
{'series': [

influxdb/tests/server_tests/client_test_with_server.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,6 @@ def test_create_database(self):
133133
[{'name': 'new_db_1'}, {'name': 'new_db_2'}]
134134
)
135135

136-
def test_get_list_series_empty(self):
137-
rsp = self.cli.get_list_series()
138-
self.assertEqual([], rsp)
139-
140-
@unittest.skip("Broken as of 0.9.0")
141-
def test_get_list_series_empty_DF(self):
142-
rsp = self.cliDF.get_list_series()
143-
self.assertEqual({}, rsp)
144-
145136
def test_drop_database(self):
146137
self.test_create_database()
147138
self.assertIsNone(self.cli.drop_database('new_db_1'))
@@ -449,44 +440,10 @@ def test_query_chunked(self):
449440
del example_object
450441
# TODO ?
451442

452-
def test_get_list_series_and_delete(self):
453-
self.cli.write_points(dummy_point)
454-
rsp = self.cli.get_list_series()
455-
self.assertEqual(
456-
[
457-
{'name': 'cpu_load_short',
458-
'tags': [
459-
{'host': 'server01',
460-
'region': 'us-west',
461-
'_key':
462-
'cpu_load_short,host=server01,region=us-west'}]}
463-
],
464-
rsp
465-
)
466-
467443
def test_delete_series_invalid(self):
468444
with self.assertRaises(InfluxDBClientError):
469445
self.cli.delete_series()
470446

471-
def test_delete_series(self):
472-
self.assertEqual(len(self.cli.get_list_series()), 0)
473-
self.cli.write_points(dummy_points)
474-
self.assertEqual(len(self.cli.get_list_series()), 2)
475-
self.cli.delete_series(measurement='cpu_load_short')
476-
self.assertEqual(len(self.cli.get_list_series()), 1)
477-
self.cli.delete_series(tags={'region': 'us-west'})
478-
self.assertEqual(len(self.cli.get_list_series()), 0)
479-
480-
@unittest.skip("Broken as of 0.9.0")
481-
def test_get_list_series_DF(self):
482-
self.cli.write_points(dummy_point)
483-
rsp = self.cliDF.get_list_series()
484-
485-
expected = pd.DataFrame(
486-
[[1, 'server01', 'us-west']],
487-
columns=['_id', 'host', 'region'])
488-
assert_frame_equal(rsp['cpu_load_short'], expected)
489-
490447
def test_default_retention_policy(self):
491448
rsp = self.cli.get_list_retention_policies()
492449
self.assertEqual(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy