Skip to content

Commit

Permalink
check context value no_return
Browse files Browse the repository at this point in the history
There are queries that could be executed using this method that don't return values, like inserts, updates, deletes and those will raise errors because there are no rows and cols to collect
  • Loading branch information
aek authored and sergiocorato committed Jul 7, 2020
1 parent 77a1ee7 commit 1f9588e
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def _execute_sqlalchemy(self, sqlquery, sqlparams, metadata):
cur = connection.execute(sqlquery)
else:
cur = connection.execute(sqlquery, sqlparams)
if self.env.context.get("no_return", False):
return rows, cols
if metadata:
cols = list(cur.keys())
rows = [r for r in cur]
Expand Down

0 comments on commit 1f9588e

Please sign in to comment.