@@ -112,28 +112,16 @@ def query(self, q):
112
112
response = self .redis_con .execute_command ("GRAPH.QUERY" , self .name , q , "--compact" )
113
113
return QueryResult (self , response )
114
114
115
- def _execution_plan_to_string (self , plan , plan_str , ident = 0 ):
116
- plan_str += ("\t " * ident ) + plan [0 ] + "\n "
117
- for i in range (1 , len (plan )):
118
- plan_str = self ._execution_plan_to_string (plan [i ], plan_str , ident + 1 )
119
- return plan_str
115
+ def _execution_plan_to_string (self , plan ):
116
+ return "\n " .join (plan )
120
117
121
118
def execution_plan (self , query ):
122
119
"""
123
- Get the execution plan for given query.
124
- GRAPH.EXPLAIN returns a nested set of arrays
125
- the first element of each array is a string representing
126
- the current operation, followed by 0 or more sub-arrays
127
- one for each child operation.
120
+ Get the execution plan for given query,
121
+ GRAPH.EXPLAIN returns an array of operations.
128
122
"""
129
123
plan = self .redis_con .execute_command ("GRAPH.EXPLAIN" , self .name , query )
130
- plan_str = ""
131
- # TODO: Consider switching to a tree structure
132
- # https://treelib.readthedocs.io/en/latest/
133
- # make sure we're able to search for a specific operation
134
- # within the tree.
135
- plan_str = self ._execution_plan_to_string (plan , plan_str )
136
- return plan_str
124
+ return self ._execution_plan_to_string (plan )
137
125
138
126
def delete (self ):
139
127
"""
0 commit comments