API

High Level API

DynamoDB Models for PynamoDB

class pynamodb.models.Model(hash_key=None, range_key=None, **attributes)

Defines a PynamoDB Model

This model is backed by a table in DynamoDB. You can create the table by with the create_table method.

exception DoesNotExist(msg=None, cause=None)

Raised when an item queried does not exist

classmethod batch_get(items, consistent_read=None, attributes_to_get=None)

BatchGetItem for this model

Parameters:items – Should be a list of hash keys to retrieve, or a list of tuples if range keys are used.
classmethod batch_write(auto_commit=True)

Returns a BatchWrite context manager for a batch operation.

Parameters:auto_commit – If true, the context manager will commit writes incrementally as items are written to as necessary to honor item count limits in the DynamoDB API (see BatchWrite). Regardless of the value passed here, changes automatically commit on context exit (whether successful or not).
classmethod count(hash_key=None, range_key_condition=None, filter_condition=None, consistent_read=False, index_name=None, limit=None, rate_limit=None, **filters)

Provides a filtered count

Parameters:
  • hash_key – The hash key to query. Can be None.
  • range_key_condition – Condition for range key
  • filter_condition – Condition used to restrict the query results
  • consistent_read – If True, a consistent read is performed
  • index_name – If set, then this index is used
  • filters – A dictionary of filters to be used in the query. Requires a hash_key to be passed.
classmethod create_table(wait=False, read_capacity_units=None, write_capacity_units=None)

Create the table for this model

Parameters:
  • wait – If set, then this call will block until the table is ready for use
  • read_capacity_units – Sets the read capacity units for this table
  • write_capacity_units – Sets the write capacity units for this table
delete(condition=None, conditional_operator=None, **expected_values)

Deletes this object from dynamodb

classmethod delete_table()

Delete the table for this model

classmethod describe_table()

Returns the result of a DescribeTable operation on this model’s table

classmethod dump(filename)

Writes the contents of this model’s table as JSON to the given filename

classmethod dumps()

Returns a JSON representation of this model’s table

classmethod exists()

Returns True if this table exists, False otherwise

classmethod from_raw_data(data)

Returns an instance of this class from the raw data

Parameters:data – A serialized DynamoDB object
classmethod get(hash_key, range_key=None, consistent_read=False, attributes_to_get=None)

Returns a single object using the provided keys

Parameters:
  • hash_key – The hash key of the desired item
  • range_key – The range key of the desired item, only used when appropriate.
classmethod query(hash_key, range_key_condition=None, filter_condition=None, consistent_read=False, index_name=None, scan_index_forward=None, conditional_operator=None, limit=None, last_evaluated_key=None, attributes_to_get=None, page_size=None, rate_limit=None, **filters)

Provides a high level query API

Parameters:
  • hash_key – The hash key to query
  • range_key_condition – Condition for range key
  • filter_condition – Condition used to restrict the query results
  • consistent_read – If True, a consistent read is performed
  • index_name – If set, then this index is used
  • limit – Used to limit the number of results returned
  • scan_index_forward – If set, then used to specify the same parameter to the DynamoDB API. Controls descending or ascending results
  • conditional_operator
  • last_evaluated_key – If set, provides the starting point for query.
  • attributes_to_get – If set, only returns these elements
  • page_size – Page size of the query to DynamoDB
  • filters – A dictionary of filters to be used in the query
classmethod rate_limited_scan(filter_condition=None, attributes_to_get=None, segment=None, total_segments=None, limit=None, conditional_operator=None, last_evaluated_key=None, page_size=None, timeout_seconds=None, read_capacity_to_consume_per_second=10, allow_rate_limited_scan_without_consumed_capacity=None, max_sleep_between_retry=10, max_consecutive_exceptions=30, consistent_read=None, index_name=None, **filters)

Scans the items in the table at a definite rate. Invokes the low level rate_limited_scan API.

Parameters:
  • filter_condition – Condition used to restrict the scan results
  • attributes_to_get – A list of attributes to return.
  • segment – If set, then scans the segment
  • total_segments – If set, then specifies total segments
  • limit – Used to limit the number of results returned
  • conditional_operator
  • last_evaluated_key – If set, provides the starting point for scan.
  • page_size – Page size of the scan to DynamoDB
  • filters – A list of item filters
  • timeout_seconds – Timeout value for the rate_limited_scan method, to prevent it from running infinitely
  • read_capacity_to_consume_per_second – Amount of read capacity to consume every second
  • allow_rate_limited_scan_without_consumed_capacity – If set, proceeds without rate limiting if the server does not support returning consumed capacity in responses.
  • max_sleep_between_retry – Max value for sleep in seconds in between scans during throttling/rate limit scenarios
  • max_consecutive_exceptions – Max number of consecutive provision throughput exceeded exceptions for scan to exit
  • consistent_read – If True, a consistent read is performed
refresh(consistent_read=False)

Retrieves this object’s data from dynamodb and syncs this local object

Parameters:consistent_read – If True, then a consistent read is performed.
save(condition=None, conditional_operator=None, **expected_values)

Save this object to dynamodb

classmethod scan(filter_condition=None, segment=None, total_segments=None, limit=None, conditional_operator=None, last_evaluated_key=None, page_size=None, consistent_read=None, index_name=None, rate_limit=None, **filters)

Iterates through all items in the table

Parameters:
  • filter_condition – Condition used to restrict the scan results
  • segment – If set, then scans the segment
  • total_segments – If set, then specifies total segments
  • limit – Used to limit the number of results returned
  • conditional_operator
  • last_evaluated_key – If set, provides the starting point for scan.
  • page_size – Page size of the scan to DynamoDB
  • filters – A list of item filters
  • consistent_read – If True, a consistent read is performed
update(attributes=None, actions=None, condition=None, conditional_operator=None, **expected_values)

Updates an item using the UpdateItem operation.

Parameters:attributes

A dictionary of attributes to update in the following format {

attr_name: {‘value’: 10, ‘action’: ‘ADD’}, next_attr: {‘value’: True, ‘action’: ‘PUT’},

}

update_item(attribute, value=None, action=None, condition=None, conditional_operator=None, **expected_values)

Updates an item using the UpdateItem operation.

This should be used for updating a single attribute of an item.

Parameters:

PynamoDB attributes

class pynamodb.attributes.Attribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

An attribute of a model

deserialize(value)

Performs any needed deserialization on the value

serialize(value)

This method should return a dynamodb compatible value

class pynamodb.attributes.BinaryAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A binary attribute

deserialize(value)

Returns a decoded string from base64

serialize(value)

Returns a base64 encoded binary string

class pynamodb.attributes.BinarySetAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A binary set

deserialize(value)

Returns a decoded string from base64

serialize(value)

Returns a base64 encoded binary string

class pynamodb.attributes.BooleanAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A class for boolean attributes

deserialize(value)

Performs any needed deserialization on the value

serialize(value)

This method should return a dynamodb compatible value

class pynamodb.attributes.JSONAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A JSON Attribute

Encodes JSON to unicode internally

deserialize(value)

Deserializes JSON

serialize(value)

Serializes JSON to unicode

class pynamodb.attributes.LegacyBooleanAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A class for legacy boolean attributes

Previous versions of this library serialized bools as numbers. This class allows you to continue to use that functionality.

deserialize(value)

Performs any needed deserialization on the value

serialize(value)

This method should return a dynamodb compatible value

class pynamodb.attributes.ListAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None, of=None)
deserialize(values)

Decode from list of AttributeValue types.

serialize(values)

Encode the given list of objects into a list of AttributeValue types.

class pynamodb.attributes.MapAttribute(**attributes)

A Map Attribute

The MapAttribute class can be used to store a JSON document as “raw” name-value pairs, or it can be subclassed and the document fields represented as class attributes using Attribute instances.

To support the ability to subclass MapAttribute and use it as an AttributeContainer, instances of MapAttribute behave differently based both on where they are instantiated and on their type. Because of this complicated behavior, a bit of an introduction is warranted.

Models that contain a MapAttribute define its properties using a class attribute on the model. For example, below we define “MyModel” which contains a MapAttribute “my_map”:

class MyModel(Model):
my_map = MapAttribute(attr_name=”dynamo_name”, default={})

When instantiated in this manner (as a class attribute of an AttributeContainer class), the MapAttribute class acts as an instance of the Attribute class. The instance stores data about the attribute (in this example the dynamo name and default value), and acts as a data descriptor, storing any value bound to it on the attribute_values dictionary of the containing instance (in this case an instance of MyModel).

Unlike other Attribute types, the value that gets bound to the containing instance is a new instance of MapAttribute, not an instance of the primitive type. For example, a UnicodeAttribute stores strings in the attribute_values of the containing instance; a MapAttribute does not store a dict but instead stores a new instance of itself. This difference in behavior is necessary when subclassing MapAttribute in order to access the Attribute data descriptors that represent the document fields.

For example, below we redefine “MyModel” to use a subclass of MapAttribute as “my_map”:

class MyMapAttribute(MapAttribute):
my_internal_map = MapAttribute()
class MyModel(Model):
my_map = MyMapAttribute(attr_name=”dynamo_name”, default = {})

In order to set the value of my_internal_map on an instance of MyModel we need the bound value for “my_map” to be an instance of MapAttribute so that it acts as a data descriptor:

MyModel().my_map.my_internal_map = {‘foo’: ‘bar’}

That is the attribute access of “my_map” must return a MyMapAttribute instance and not a dict.

When an instance is used in this manner (bound to an instance of an AttributeContainer class), the MapAttribute class acts as an AttributeContainer class itself. The instance does not store data about the attribute, and does not act as a data descriptor. The instance stores name-value pairs in its internal attribute_values dictionary.

Thus while MapAttribute multiply inherits from Attribute and AttributeContainer, a MapAttribute instance does not behave as both an Attribute AND an AttributeContainer. Rather an instance of MapAttribute behaves EITHER as an Attribute OR as an AttributeContainer, depending on where it was instantiated.

So, how do we create this dichotomous behavior? Using the AttributeContainerMeta metaclass. All MapAttribute instances are initialized as AttributeContainers only. During construction of AttributeContainer classes (subclasses of MapAttribute and Model), any instances that are class attributes are transformed from AttributeContainers to Attributes (via the _make_attribute method call).

deserialize(values)

Decode as a dict.

serialize(values)

This method should return a dynamodb compatible value

class pynamodb.attributes.MapAttributeMeta(name, bases, attrs)

This is only here for backwards compatibility: i.e. so type(MapAttribute) == MapAttributeMeta

class pynamodb.attributes.NullAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)
deserialize(value)

Performs any needed deserialization on the value

serialize(value)

This method should return a dynamodb compatible value

class pynamodb.attributes.NumberAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A number attribute

deserialize(value)

Decode numbers from JSON

serialize(value)

Encode numbers as JSON

class pynamodb.attributes.NumberSetAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A number set attribute

class pynamodb.attributes.SetMixin

Adds (de)serialization methods for sets

deserialize(value)

Deserializes a set

serialize(value)

Serializes a set

Because dynamodb doesn’t store empty attributes, empty sets return None

class pynamodb.attributes.UTCDateTimeAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

An attribute for storing a UTC Datetime

deserialize(value)

Takes a UTC datetime string and returns a datetime object

serialize(value)

Takes a datetime object and returns a string

class pynamodb.attributes.UnicodeAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A unicode attribute

serialize(value)

Returns a unicode string

class pynamodb.attributes.UnicodeSetAttribute(hash_key=False, range_key=False, null=None, default=None, attr_name=None)

A unicode set

deserialize(value)

Deserializes a set

element_serialize(value)

This serializes unicode / strings out as unicode strings. It does not touch the value if it is already a unicode str :param value: :return:

serialize(value)

Serializes a set

Because dynamodb doesn’t store empty attributes, empty sets return None

PynamoDB Indexes

class pynamodb.indexes.AllProjection

An ALL projection

class pynamodb.indexes.GlobalSecondaryIndex

A global secondary index

class pynamodb.indexes.IncludeProjection(non_attr_keys=None)

An INCLUDE projection

class pynamodb.indexes.Index

Base class for secondary indexes

classmethod count(hash_key, range_key_condition=None, filter_condition=None, consistent_read=False, **filters)

Count on an index

classmethod query(hash_key, range_key_condition=None, filter_condition=None, scan_index_forward=None, consistent_read=False, limit=None, last_evaluated_key=None, attributes_to_get=None, **filters)

Queries an index

classmethod scan(filter_condition=None, segment=None, total_segments=None, limit=None, conditional_operator=None, last_evaluated_key=None, page_size=None, consistent_read=None, **filters)

Scans an index

class pynamodb.indexes.IndexMeta(name, bases, attrs)

Index meta class

This class is here to allow for an index Meta class that contains the index settings

class pynamodb.indexes.KeysOnlyProjection

Keys only projection

class pynamodb.indexes.LocalSecondaryIndex

A local secondary index

class pynamodb.indexes.Projection

A class for presenting projections

Low Level API

PynamoDB lowest level connection

class pynamodb.connection.Connection(region=None, host=None, session_cls=None, request_timeout_seconds=None, max_retry_attempts=None, base_backoff_ms=None)

A higher level abstraction over botocore

batch_get_item(table_name, keys, consistent_read=None, return_consumed_capacity=None, attributes_to_get=None)

Performs the batch get item operation

batch_write_item(table_name, put_items=None, delete_items=None, return_consumed_capacity=None, return_item_collection_metrics=None)

Performs the batch_write_item operation

client

Returns a botocore dynamodb client

create_table(table_name, attribute_definitions=None, key_schema=None, read_capacity_units=None, write_capacity_units=None, global_secondary_indexes=None, local_secondary_indexes=None, stream_specification=None)

Performs the CreateTable operation

delete_item(table_name, hash_key, range_key=None, condition=None, expected=None, conditional_operator=None, return_values=None, return_consumed_capacity=None, return_item_collection_metrics=None)

Performs the DeleteItem operation and returns the result

delete_table(table_name)

Performs the DeleteTable operation

describe_table(table_name)

Performs the DescribeTable operation

dispatch(operation_name, operation_kwargs)

Dispatches operation_name with arguments operation_kwargs

Raises TableDoesNotExist if the specified table does not exist

get_attribute_type(table_name, attribute_name, value=None)

Returns the proper attribute type for a given attribute name :param value: The attribute value an be supplied just in case the type is already included

get_conditional_operator(operator)

Returns a dictionary containing the correct conditional operator, validating it first.

get_consumed_capacity_map(return_consumed_capacity)

Builds the consumed capacity map that is common to several operations

get_exclusive_start_key_map(table_name, exclusive_start_key)

Builds the exclusive start key attribute map

get_expected_map(table_name, expected)

Builds the expected map that is common to several operations

get_identifier_map(table_name, hash_key, range_key=None, key='Key')

Builds the identifier map that is common to several operations

get_item(table_name, hash_key, range_key=None, consistent_read=False, attributes_to_get=None)

Performs the GetItem operation and returns the result

get_item_attribute_map(table_name, attributes, item_key='Item', pythonic_key=True)

Builds up a dynamodb compatible AttributeValue map

get_item_collection_map(return_item_collection_metrics)

Builds the item collection map

get_meta_table(table_name, refresh=False)

Returns a MetaTable

get_query_filter_map(table_name, query_filters)

Builds the QueryFilter object needed for the Query operation

get_return_values_map(return_values)

Builds the return values map that is common to several operations

list_tables(exclusive_start_table_name=None, limit=None)

Performs the ListTables operation

parse_attribute(attribute, return_type=False)

Returns the attribute value, where the attribute can be a raw attribute value, or a dictionary containing the type: {‘S’: ‘String value’}

put_item(table_name, hash_key, range_key=None, attributes=None, condition=None, expected=None, conditional_operator=None, return_values=None, return_consumed_capacity=None, return_item_collection_metrics=None)

Performs the PutItem operation and returns the result

query(table_name, hash_key, range_key_condition=None, filter_condition=None, attributes_to_get=None, consistent_read=False, exclusive_start_key=None, index_name=None, key_conditions=None, query_filters=None, conditional_operator=None, limit=None, return_consumed_capacity=None, scan_index_forward=None, select=None)

Performs the Query operation and returns the result

rate_limited_scan(table_name, filter_condition=None, attributes_to_get=None, page_size=None, limit=None, conditional_operator=None, scan_filter=None, exclusive_start_key=None, segment=None, total_segments=None, timeout_seconds=None, read_capacity_to_consume_per_second=10, allow_rate_limited_scan_without_consumed_capacity=None, max_sleep_between_retry=10, max_consecutive_exceptions=10, consistent_read=None, index_name=None)

Performs a rate limited scan on the table. The API uses the scan API to fetch items from DynamoDB. The rate_limited_scan uses the ‘ConsumedCapacity’ value returned from DynamoDB to limit the rate of the scan. ‘ProvisionedThroughputExceededException’ is also handled and retried.

Parameters:
  • table_name – Name of the table to perform scan on.
  • filter_condition – Condition used to restrict the scan results
  • attributes_to_get – A list of attributes to return.
  • page_size – Page size of the scan to DynamoDB
  • limit – Used to limit the number of results returned
  • conditional_operator
  • scan_filter – A map indicating the condition that evaluates the scan results
  • exclusive_start_key – If set, provides the starting point for scan.
  • segment – If set, then scans the segment
  • total_segments – If set, then specifies total segments
  • timeout_seconds – Timeout value for the rate_limited_scan method, to prevent it from running infinitely
  • read_capacity_to_consume_per_second – Amount of read capacity to consume every second
  • allow_rate_limited_scan_without_consumed_capacity – If set, proceeds without rate limiting if the server does not support returning consumed capacity in responses.
  • max_sleep_between_retry – Max value for sleep in seconds in between scans during throttling/rate limit scenarios
  • max_consecutive_exceptions – Max number of consecutive ProvisionedThroughputExceededException exception for scan to exit
  • consistent_read – enable consistent read
  • index_name – an index to perform the scan on
requests_session

Return a requests session to execute prepared requests using the same pool

scan(table_name, filter_condition=None, attributes_to_get=None, limit=None, conditional_operator=None, scan_filter=None, return_consumed_capacity=None, exclusive_start_key=None, segment=None, total_segments=None, consistent_read=None, index_name=None)

Performs the scan operation

session

Returns a valid botocore session

update_item(table_name, hash_key, range_key=None, actions=None, attribute_updates=None, condition=None, expected=None, return_consumed_capacity=None, conditional_operator=None, return_item_collection_metrics=None, return_values=None)

Performs the UpdateItem operation

update_table(table_name, read_capacity_units=None, write_capacity_units=None, global_secondary_index_updates=None)

Performs the UpdateTable operation

class pynamodb.connection.TableConnection(table_name, region=None, host=None, session_cls=None, request_timeout_seconds=None, max_retry_attempts=None, base_backoff_ms=None, aws_access_key_id=None, aws_secret_access_key=None)

A higher level abstraction over botocore

batch_get_item(keys, consistent_read=None, return_consumed_capacity=None, attributes_to_get=None)

Performs the batch get item operation

batch_write_item(put_items=None, delete_items=None, return_consumed_capacity=None, return_item_collection_metrics=None)

Performs the batch_write_item operation

create_table(attribute_definitions=None, key_schema=None, read_capacity_units=None, write_capacity_units=None, global_secondary_indexes=None, local_secondary_indexes=None, stream_specification=None)

Performs the CreateTable operation and returns the result

delete_item(hash_key, range_key=None, condition=None, expected=None, conditional_operator=None, return_values=None, return_consumed_capacity=None, return_item_collection_metrics=None)

Performs the DeleteItem operation and returns the result

delete_table()

Performs the DeleteTable operation and returns the result

describe_table()

Performs the DescribeTable operation and returns the result

get_item(hash_key, range_key=None, consistent_read=False, attributes_to_get=None)

Performs the GetItem operation and returns the result

get_meta_table(refresh=False)

Returns a MetaTable

put_item(hash_key, range_key=None, attributes=None, condition=None, expected=None, conditional_operator=None, return_values=None, return_consumed_capacity=None, return_item_collection_metrics=None)

Performs the PutItem operation and returns the result

query(hash_key, range_key_condition=None, filter_condition=None, attributes_to_get=None, consistent_read=False, exclusive_start_key=None, index_name=None, key_conditions=None, query_filters=None, limit=None, return_consumed_capacity=None, scan_index_forward=None, conditional_operator=None, select=None)

Performs the Query operation and returns the result

rate_limited_scan(filter_condition=None, attributes_to_get=None, page_size=None, limit=None, conditional_operator=None, scan_filter=None, segment=None, total_segments=None, exclusive_start_key=None, timeout_seconds=None, read_capacity_to_consume_per_second=None, allow_rate_limited_scan_without_consumed_capacity=None, max_sleep_between_retry=None, max_consecutive_exceptions=None, consistent_read=None, index_name=None)

Performs the scan operation with rate limited

scan(filter_condition=None, attributes_to_get=None, limit=None, conditional_operator=None, scan_filter=None, return_consumed_capacity=None, segment=None, total_segments=None, exclusive_start_key=None, consistent_read=None, index_name=None)

Performs the scan operation

update_item(hash_key, range_key=None, actions=None, attribute_updates=None, condition=None, expected=None, conditional_operator=None, return_consumed_capacity=None, return_item_collection_metrics=None, return_values=None)

Performs the UpdateItem operation

update_table(read_capacity_units=None, write_capacity_units=None, global_secondary_index_updates=None)

Performs the UpdateTable operation and returns the result

Exceptions

exception pynamodb.exceptions.PynamoDBConnectionError(msg=None, cause=None)

A base class for connection errors

exception pynamodb.exceptions.DeleteError(msg=None, cause=None)

Raised when an error occurs deleting an item

exception pynamodb.exceptions.QueryError(msg=None, cause=None)

Raised when queries fail

exception pynamodb.exceptions.ScanError(msg=None, cause=None)

Raised when a scan operation fails

exception pynamodb.exceptions.PutError(msg=None, cause=None)

Raised when an item fails to be created

exception pynamodb.exceptions.UpdateError(msg=None, cause=None)

Raised when an item fails to be updated

exception pynamodb.exceptions.GetError(msg=None, cause=None)

Raised when an item fails to be retrieved

exception pynamodb.exceptions.TableError(msg=None, cause=None)

An error involving a dynamodb table operation

exception pynamodb.exceptions.TableDoesNotExist(table_name)

Raised when an operation is attempted on a table that doesn’t exist

exception pynamodb.exceptions.DoesNotExist(msg=None, cause=None)

Raised when an item queried does not exist

Migration API

Contains helpers to assist in “migrations” from one version of PynamoDB to the next, in cases where breaking changes have happened.

pynamodb.migration.migrate_boolean_attributes(model_class, attribute_names, read_capacity_to_consume_per_second=10, allow_rate_limited_scan_without_consumed_capacity=False, mock_conditional_update_failure=False, page_size=None, limit=None, number_of_secs_to_back_off=1)

Migrates boolean attributes per GitHub issue 404.

Will scan through all objects and perform a conditional update against any items that store any of the given attribute names as integers. Rate limiting is performed by passing an appropriate value as read_capacity_to_consume_per_second (which defaults to something extremely conservative and slow).

Note that updates require provisioned write capacity as well. Please see the DynamoDB docs for more information. Keep in mind that there is not a simple 1:1 mapping between provisioned read capacity and write capacity. Make sure they are balanced. A conservative calculation would assume that every object visted results in an update.

The function with log at level INFO the final outcome, and the return values help identify how many items needed changing and how many of them succeed. For example, if you had 10 items in the table and every one of them had an attribute that needed migration, and upon migration we had one item which failed the migration due to a concurrent update by another writer, the return value would be: (10, 1)

Suggesting that 9 were updated successfully.

It is suggested that the migration step be re-ran until the return value is (0, 0).

Parameters:
  • model_class – The Model class for which you are migrating. This should be the up-to-date Model class using a BooleanAttribute for the relevant attributes.
  • attribute_names – List of strings that signifiy the names of attributes which are potentially in need of migration.
  • read_capacity_to_consume_per_second – Passed along to the underlying rate_limited_scan and intended as the mechanism to rate limit progress. Please see notes below around write capacity.
  • allow_rate_limited_scan_without_consumed_capacity – Passed along to rate_limited_scan; intended to allow unit tests to pass against DynamoDB Local.
  • mock_conditional_update_failure – Only used for unit testing. When True, the conditional update expression used internally is updated such that it is guaranteed to fail. This is meant to trigger the code path in boto, to allow us to unit test that we are jumping through appropriate hoops handling the resulting failure and distinguishing it from other failures.
  • page_size – Passed along to the underlying ‘page_size’. Page size of the scan to DynamoDB.
  • limit – Passed along to the underlying ‘limit’. Used to limit the number of results returned.
  • number_of_secs_to_back_off – Number of seconds to sleep when exceeding capacity.
Returns:

(number_of_items_in_need_of_update, number_of_them_that_failed_due_to_conditional_update)