Skip to content

Iterable query results

The classes JobQueryResultHco, ProcessingStepQueryResultHco, and WorkDataQueryResultHco represent a single page of query results. To get results from the next page, one must navigate to the next_link, provided that it is not None. To make it easier to process all items returned by the query, these classes now contain two methods: iter() and iter_flat().

The iter() method returns an Iterable of pages of the query result so that all pages can be processed in a loop.

for page in jobs_root.job_query_action.execute(query).iter():
for job in page.jobs:
# process the job

The iter_flat() method flattens the result provided by iter() and returns an Iterable of the corresponding HCO entity (Job, ProcessingStep or Workdata), allowing these entities to be processed in a loop.

for job in jobs.job_query_action.execute(query).iter_flat():
# process the job