File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -18,17 +18,19 @@ def run(self, **kwargs):
1818
1919 query = self .get_del_arg ('query' , kwargs_dict )
2020
21+ return_result = None
2122 with self .db_connection (kwargs_dict ) as conn :
2223 # Execute the query
2324 query_result = conn .execute (query )
2425
25- return_result = {'affected_rows' : query_result .rowcount }
26- if query_result .returns_rows :
27- return_result = []
28- all_results = query_result .fetchall ()
29- for row in all_results :
30- # Rows are returned as tuples with keys.
31- # Convert that to a dictionary for return
32- return_result .append (self .row_to_dict (row ))
26+ # We need to execute these commands while connection is still open.
27+ return_result = {'affected_rows' : query_result .rowcount }
28+ if query_result .returns_rows :
29+ return_result = []
30+ all_results = query_result .fetchall ()
31+ for row in all_results :
32+ # Rows are returned as tuples with keys.
33+ # Convert that to a dictionary for return
34+ return_result .append (self .row_to_dict (row ))
3335
3436 return return_result
You can’t perform that action at this time.
0 commit comments