diff options
Diffstat (limited to 'lib/extras.py')
-rw-r--r-- | lib/extras.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/extras.py b/lib/extras.py index dcbd65e..1a4b730 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -304,7 +304,14 @@ class NamedTupleCursor(_cursor): return [nt(*t) for t in ts] def __iter__(self): - return iter(self.fetchall()) + # Invoking _cursor.__iter__(self) goes to infinite recursion, + # so we do pagination by hand + while 1: + recs = self.fetchmany(self.itersize) + if not recs: + return + for rec in recs: + yield rec try: from collections import namedtuple |