Batch large-table loads to bound memory and add per-table state to stats
This commit is contained in:
+10
-2
@@ -10,11 +10,19 @@ from sqlmem.cache import CacheManager
|
||||
|
||||
class _FakeCursor:
|
||||
def __init__(self, rows):
|
||||
self._rows = rows
|
||||
self._rows = list(rows)
|
||||
self._pos = 0
|
||||
self.description = None
|
||||
|
||||
def fetchall(self):
|
||||
return self._rows
|
||||
out = self._rows[self._pos :]
|
||||
self._pos = len(self._rows)
|
||||
return out
|
||||
|
||||
def fetchmany(self, size):
|
||||
out = self._rows[self._pos : self._pos + size]
|
||||
self._pos += len(out)
|
||||
return out
|
||||
|
||||
|
||||
class FakeSource:
|
||||
|
||||
Reference in New Issue
Block a user