Skip to content

Commit

Permalink
add extras execute_batch
Browse files Browse the repository at this point in the history
  • Loading branch information
vir-mir committed Dec 6, 2019
1 parent 17b5e4c commit ccd5a46
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions aiopg/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@ def _paginate(seq, page_size):
count = len(seq)
it = iter(seq)
for s in range(count + 1):
try:
for i in range(page_size):
page.append(next(it))
yield page
page = []
except StopIteration:
if page:
yield page
return
for i in range(page_size):
page.append(next(it))
yield page
page = []


async def execute_batch(cur, sql, argslist, page_size=100):
Expand Down

0 comments on commit ccd5a46

Please sign in to comment.