Skip to content

Commit

Permalink
Change default iterate chunk size
Browse files Browse the repository at this point in the history
on AnnotationValue model
  • Loading branch information
gregorjerse committed Mar 7, 2024
1 parent 2abfb81 commit d81a36c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Added
-----
- Add ``restart`` method to the ``Data`` resource

Changed
-------
- Default chunk size for ``iterate`` on ``AnnotationValue`` is set to 10.000


===================
21.1.0 - 2023-02-09
Expand Down
12 changes: 12 additions & 0 deletions src/resdk/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,3 +423,15 @@ def _fetch(self):
for value in missing[field.id]:
value._field = field
value._original_values["field"] = field._original_values

def iterate(self, chunk_size=10000, show_progress=False):
"""
Iterate through query.
This can come handy when one wishes to iterate through hundreds or
thousands of objects and would otherwise get "504 Gateway-timeout".
The method cannot be used together with the following filters:
limit, offset and ordering, and will raise a ``ValueError``.
"""
super().iterate(chunk_size=chunk_size, show_progress=show_progress)

0 comments on commit d81a36c

Please sign in to comment.