API

High Level API

class pynamodb.pagination.PageIterator(operation: ~typing.Callable, args: ~typing.Any, kwargs: ~typing.Dict[str, ~typing.Any], rate_limit: ~typing.Optional[float] = None, settings: ~pynamodb.settings.OperationSettings = <pynamodb.settings.OperationSettings object>)

PageIterator handles Query and Scan result pagination.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.Pagination.html https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.Pagination

class pynamodb.pagination.RateLimiter(rate_limit: float, time_module: Optional[Any] = None)

RateLimiter limits operations to a pre-set rate of units/seconds

Example:
Initialize a RateLimiter with the desired rate

rate_limiter = RateLimiter(rate_limit)

Now, every time before calling an operation, call acquire()

rate_limiter.acquire()

And after an operation, update the number of units consumed

rate_limiter.consume(units)

acquire() None

Sleeps the appropriate amount of time to follow the rate limit restriction

Returns

None

consume(units: int) None

Records the amount of units consumed.

Parameters

units – Number of units consumed

Returns

None

property rate_limit: float

A limit of units per seconds

class pynamodb.pagination.ResultIterator(operation: ~typing.Callable, args: ~typing.Any, kwargs: ~typing.Dict[str, ~typing.Any], map_fn: ~typing.Optional[~typing.Callable] = None, limit: ~typing.Optional[int] = None, rate_limit: ~typing.Optional[float] = None, settings: ~pynamodb.settings.OperationSettings = <pynamodb.settings.OperationSettings object>)

ResultIterator handles Query and Scan item pagination.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.Pagination.html https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.Pagination

Low Level API

Exceptions