Merge PR #274 into 16.0

Signed-off-by dreispt
This commit is contained in:
OCA-git-bot
2024-03-09 14:36:57 +00:00

View File

@@ -38,5 +38,7 @@ class BaseExternalDbsource(models.Model):
cur = connection.execute(sqlquery, sqlparams)
if metadata:
cols = list(cur.keys())
rows = [r for r in cur]
# If the query doesn't return rows, trying to get them anyway
# will raise an exception `sqlalchemy.exc.ResourceClosedError`
rows = [r for r in cur] if cur.returns_rows else []
return rows, cols