You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/12/19 08:48:16 UTC

[iotdb] 01/01: [To rel/0.13][IOTDB-5236] Fix DeleteData Python API cannot work

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch python_delete_0.13
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 25248ea8b6eff840c9b0df8647f2fc48513a1a56
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Dec 19 16:47:26 2022 +0800

    [To rel/0.13][IOTDB-5236] Fix DeleteData Python API cannot work
---
 client-py/iotdb/Session.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/client-py/iotdb/Session.py b/client-py/iotdb/Session.py
index 88af9e8343..9c0cecf7e4 100644
--- a/client-py/iotdb/Session.py
+++ b/client-py/iotdb/Session.py
@@ -345,7 +345,23 @@ class Session(object):
         :param paths_list: time series list that the data in.
         :param timestamp: data with time stamp less than or equal to time will be deleted.
         """
-        request = TSDeleteDataReq(self.__session_id, paths_list, timestamp)
+        request = TSDeleteDataReq(self.__session_id, paths_list, -9223372036854775808, end_time)
+        try:
+            status = self.__client.deleteData(request)
+            logger.debug(
+                "delete data from {}, message: {}".format(paths_list, status.message)
+            )
+        except TTransport.TException as e:
+            logger.exception("data deletion fails because: ", e)
+
+    def delete_data_in_range(self, paths_list, start_time, end_time):
+        """
+        delete data >= start_time and data <= end_time in multiple timeseries
+        :param paths_list: time series list that the data in.
+        :param start_time: delete range start time.
+        :param end_time: delete range end time.
+        """
+        request = TSDeleteDataReq(self.__session_id, paths_list, start_time, end_time)
         try:
             status = self.__client.deleteData(request)
             logger.debug(