-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Description
The AQLQuery object in the pyarango library is not compatible with itertools.batched, leading to an endless loop.
When the iterator is exhausted, calling next() raises StopIteration. However, calling next() again on the iterator restarts it, returning the first result instead of raising StopIteration again. This behavior leads itertools.batched to make an infinite loop.
See following example:
import itertools
from pyArango.connection import Connection
print(f"Connecting...")
cnx = Connection(
arangoURL="http://localhost:8529",
username="datalake",
password="datalake",
timeout=30,
)
db = cnx["datalake"]
# my database contains 12 links
relations = db.AQLQuery(
f"""
FOR link IN links
RETURN link
""",
rawResults=True,
)
for batch in itertools.batched(relations, 100):
print(f"iteration")
The iterator should raise StopIteration consistently when exhausted.
Metadata
Metadata
Assignees
Labels
No labels