Skip to content

Commit df89dc1

Browse files
author
aviau
committed
Merge branch 'fix_delete_series'
2 parents 6d1bc11 + acc3e5d commit df89dc1

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

influxdb/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,17 +605,17 @@ def set_user_password(self, username, password):
605605
text = "SET PASSWORD FOR {} = '{}'".format(username, password)
606606
self.query(text)
607607

608-
def delete_series(self, name, database=None):
608+
def delete_series(self, id, database=None):
609609
"""Delete series from a database.
610610
611-
:param name: the name of the series to be deleted
612-
:type name: str
611+
:param id: the id of the series to be deleted
612+
:type id: int
613613
:param database: the database from which the series should be
614614
deleted, defaults to client's current database
615615
:type database: str
616616
"""
617617
database = database or self._database
618-
self.query('DROP SERIES \"%s\"' % name, database=database)
618+
self.query('DROP SERIES %s' % id, database=database)
619619

620620
def grant_admin_privileges(self, username):
621621
"""Grant cluster administration privileges to an user.

tests/influxdb/client_test_with_server.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def test_get_list_series_empty_DF(self):
749749
rsp = self.cliDF.get_list_series()
750750
self.assertEqual({}, rsp)
751751

752-
def test_get_list_series(self):
752+
def test_get_list_series_and_delete(self):
753753
self.cli.write_points(dummy_point)
754754
rsp = self.cli.get_list_series()
755755
self.assertEqual(
@@ -761,6 +761,19 @@ def test_get_list_series(self):
761761
rsp
762762
)
763763

764+
def test_delete_series(self):
765+
self.assertEqual(
766+
len(self.cli.get_list_series()), 0
767+
)
768+
self.cli.write_points(dummy_point)
769+
self.assertEqual(
770+
len(self.cli.get_list_series()), 1
771+
)
772+
self.cli.delete_series(1)
773+
self.assertEqual(
774+
len(self.cli.get_list_series()), 0
775+
)
776+
764777
@skipIfPYpy
765778
def test_get_list_series_DF(self):
766779
self.cli.write_points(dummy_point)

0 commit comments

Comments
 (0)