Coverage for mindsdb / integrations / utilities / handlers / query_utilities / delete_query_utilities.py: 0%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1from mindsdb_sql_parser import ast 

2 

3from mindsdb.integrations.utilities.handlers.query_utilities.base_query_utilities import BaseQueryParser 

4from mindsdb.integrations.utilities.handlers.query_utilities.base_query_utilities import BaseQueryExecutor 

5 

6 

7class DELETEQueryParser(BaseQueryParser): 

8 """ 

9 Parses a DELETE query into its component parts. 

10 

11 Parameters 

12 ---------- 

13 query : ast.Delete 

14 Given SQL DELETE query. 

15 """ 

16 def __init__(self, query: ast.Delete): 

17 super().__init__(query) 

18 

19 def parse_query(self): 

20 """ 

21 Parses a SQL DELETE statement into its components: WHERE. 

22 """ 

23 where_conditions = self.parse_where_clause() 

24 

25 return where_conditions 

26 

27 

28class DELETEQueryExecutor(BaseQueryExecutor): 

29 """ 

30 Executes a DELETE query. 

31 

32 Parameters 

33 ---------- 

34 df : pd.DataFrame 

35 Given table. 

36 where_conditions : List[List[Text]] 

37 WHERE conditions of the query. 

38 

39 NOTE: This class DOES NOT delete the relevant records of the entity for you, it will simply return the records that need to be deleted based on the WHERE conditions. 

40 

41 This class expects all of the entities to be passed in as a DataFrane and filters out the relevant records based on the WHERE conditions. 

42 Because all of the records need to be extracted to be passed in as a DataFrame, this class is not very computationally efficient. 

43 Therefore, DO NOT use this class if the API/SDK that you are using supports deleting records in bulk. 

44 """