Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Fixed delete_series (Closes #187)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviau committed May 21, 2015
1 parent 78b8401 commit acc3e5d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 4 additions & 4 deletions influxdb/client.py
Expand Up @@ -605,17 +605,17 @@ def set_user_password(self, username, password):
text = "SET PASSWORD FOR {} = '{}'".format(username, password)
self.query(text)

def delete_series(self, name, database=None):
def delete_series(self, id, database=None):
"""Delete series from a database.
:param name: the name of the series to be deleted
:type name: str
:param id: the id of the series to be deleted
:type id: int
:param database: the database from which the series should be
deleted, defaults to client's current database
:type database: str
"""
database = database or self._database
self.query('DROP SERIES \"%s\"' % name, database=database)
self.query('DROP SERIES %s' % id, database=database)

def grant_admin_privileges(self, username):
"""Grant cluster administration privileges to an user.
Expand Down
15 changes: 14 additions & 1 deletion tests/influxdb/client_test_with_server.py
Expand Up @@ -749,7 +749,7 @@ def test_get_list_series_empty_DF(self):
rsp = self.cliDF.get_list_series()
self.assertEqual({}, rsp)

def test_get_list_series(self):
def test_get_list_series_and_delete(self):
self.cli.write_points(dummy_point)
rsp = self.cli.get_list_series()
self.assertEqual(
Expand All @@ -761,6 +761,19 @@ def test_get_list_series(self):
rsp
)

def test_delete_series(self):
self.assertEqual(
len(self.cli.get_list_series()), 0
)
self.cli.write_points(dummy_point)
self.assertEqual(
len(self.cli.get_list_series()), 1
)
self.cli.delete_series(1)
self.assertEqual(
len(self.cli.get_list_series()), 0
)

@skipIfPYpy
def test_get_list_series_DF(self):
self.cli.write_points(dummy_point)
Expand Down

0 comments on commit acc3e5d

Please sign in to comment.