Skip to content

Commit 0a2b388

Browse files
check qres.returns_rows (#42)
Signed-off-by: Erik Erlandson <eerlands@redhat.com> Signed-off-by: Erik Erlandson <eerlands@redhat.com>
1 parent 8543d85 commit 0a2b388

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

osc_ingest_trino/trino_utils.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ def _do_sql(sql, engine, verbose=False):
4747
if verbose:
4848
print(sql)
4949
qres = engine.execute(sql)
50-
res = qres.fetchall()
51-
if verbose:
52-
print(res)
50+
res = None
51+
if qres.returns_rows:
52+
res = qres.fetchall()
53+
if verbose:
54+
print(res)
5355
return res
5456

5557

0 commit comments

Comments
 (0)