Fix pg cursor

This commit is contained in:
simon987 2020-08-20 21:10:31 -04:00
parent 266f8642fb
commit b0de37d4f9
2 changed files with 3 additions and 3 deletions

View File

@ -134,7 +134,7 @@ def _deserialize(value, col_type):
def pg_fetch_cursor_all(cur, name, batch_size=1000): def pg_fetch_cursor_all(cur, name, batch_size=1000):
while True: while True:
cur.execute("FETCH FORWARD %s FROM %s", (batch_size, name)) cur.execute("FETCH FORWARD %d FROM %s" % (batch_size, name))
cnt = 0 cnt = 0
for row in cur: for row in cur:
@ -142,7 +142,7 @@ def pg_fetch_cursor_all(cur, name, batch_size=1000):
yield row yield row
if cnt != batch_size: if cnt != batch_size:
cur.execute("FETCH ALL FROM %s", (batch_size, name)) cur.execute("FETCH ALL FROM %s" % (name,))
for row in cur: for row in cur:
yield row yield row
break break

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup( setup(
name="hexlib", name="hexlib",
version="1.16", version="1.17",
description="Misc utility methods", description="Misc utility methods",
author="simon987", author="simon987",
author_email="me@simon987.net", author_email="me@simon987.net",