Skip to content

Commit

Permalink
[DOCS-2635] Document Client.paginate() (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig authored Apr 8, 2024
1 parent 7446d78 commit 95d15e8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,40 @@ Stats are returned on query responses and ServiceErrors.
emit_stats(e.stats)
# more error handling...
Pagination
------------------

Use the ``Client.paginate()`` method to iterate sets that contain more than one
page of results.

``Client.paginate()`` accepts the same query options as ``Client.query()``.

Change the default items per page using FQL's ``<set>.pageSize()`` method.

.. code-block:: python
from datetime import timedelta
from fauna import fql
from fauna.client import Client, QueryOptions
# Adjust `pageSize()` size as needed.
query = fql(
"""
Product
.byName("limes")
.pageSize(60) { description }"""
)
client = Client()
options = QueryOptions(query_timeout=timedelta(seconds=20))
pages = client.paginate(query, options)
for products in pages:
for product in products:
print(products)
Event Streaming
------------------

Expand Down

0 comments on commit 95d15e8

Please sign in to comment.