From 1f9588e011a86c1de8cf5656cdb99ed707ad1adf Mon Sep 17 00:00:00 2001 From: Axel Mendoza Date: Thu, 4 Jun 2020 12:47:52 -0500 Subject: [PATCH] check context value no_return 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 --- base_external_dbsource_sqlite/models/base_external_dbsource.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base_external_dbsource_sqlite/models/base_external_dbsource.py b/base_external_dbsource_sqlite/models/base_external_dbsource.py index ca62ceef1..8bace99ce 100644 --- a/base_external_dbsource_sqlite/models/base_external_dbsource.py +++ b/base_external_dbsource_sqlite/models/base_external_dbsource.py @@ -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]