Skip to content

Commit cbc0e12

Browse files
committed
TrinoResult.rows should not be None
1 parent 6eaef4b commit cbc0e12

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

trino/client.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -686,11 +686,11 @@ def __init__(self, query, rows: List[Any]):
686686
self._rownumber = 0
687687

688688
@property
689-
def rows(self):
689+
def rows(self) -> List[Any]:
690690
return self._rows
691691

692692
@rows.setter
693-
def rows(self, rows):
693+
def rows(self, rows: List[Any]):
694694
self._rows = rows
695695

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

710-
self._rows = next_rows
709+
self._rows = self._query.fetch() if not self._query.finished else []
711710

712711

713712
class TrinoQuery(object):

0 commit comments

Comments
 (0)