boto3.dynamodb.table

Module Contents

logger
register_table_methods(base_classes, **kwargs)
class TableResource(*args, **kwargs)

Bases:object

batch_writer(self, overwrite_by_pkeys=None)

Create a batch writer object.

This method creates a context manager for writing objects to Amazon DynamoDB in batch.

The batch writer will automatically handle buffering and sending items in batches. In addition, the batch writer will also automatically handle any unprocessed items and resend them as needed. All you need to do is call put_item for any items you want to add, and delete_item for any items you want to delete.

Example usage:

with table.batch_writer() as batch:
    for _ in xrange(1000000):
        batch.put_item(Item={'HashKey': '...',
                             'Otherstuff': '...'})
    # You can also delete_items in a batch.
    batch.delete_item(Key={'HashKey': 'SomeHashKey'})
Parameters:overwrite_by_pkeys (list(string)) – De-duplicate request items in buffer if match new request item on specified primary keys. i.e ["partition_key1", "sort_key2", "sort_key3"]
class BatchWriter(table_name, client, flush_amount=25, overwrite_by_pkeys=None)

Bases:object

Automatically handle batch writes to DynamoDB for a single table.

put_item(self, Item)
delete_item(self, Key)
_add_request_and_process(self, request)
_remove_dup_pkeys_request_if_any(self, request)
_extract_pkey_values(self, request)
_flush_if_needed(self)
_flush(self)
__enter__(self)
__exit__(self, exc_type, exc_value, tb)