Skip to content

Commit 887bbd0

Browse files
committed
TrinoResult.rows should not be None
1 parent d9d46b0 commit 887bbd0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

trino/client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,11 @@ def __init__(self, query, rows: List[Any]):
688688
self._rownumber = 0
689689

690690
@property
691-
def rows(self):
691+
def rows(self) -> List[Any]:
692692
return self._rows
693693

694694
@rows.setter
695-
def rows(self, rows):
695+
def rows(self, rows: List[Any]):
696696
self._rows = rows
697697

698698
@property
@@ -702,14 +702,13 @@ def rownumber(self) -> int:
702702
def __iter__(self):
703703
# A query only transitions to a FINISHED state when the results are fully consumed:
704704
# The reception of the data is acknowledged by calling the next_uri before exposing the data through dbapi.
705-
while not self._query.finished or self._rows is not None:
706-
next_rows = self._query.fetch() if not self._query.finished else None
705+
while not self._query.finished or self._rows:
707706
for row in self._rows:
708707
self._rownumber += 1
709708
logger.debug("row %s", row)
710709
yield row
711710

712-
self._rows = next_rows
711+
self._rows = self._query.fetch() if not self._query.finished else []
713712

714713

715714
class TrinoQuery(object):

0 commit comments

Comments
 (0)