Connection class

Class definition

class dynamodb_mapper.model.ConnectionBorg

Borg that handles access to DynamoDB.

You should never make any explicit/direct boto.dynamodb calls by yourself except for table maintenance operations :

  • boto.dynamodb.table.update_throughput()
  • boto.dynamodb.table.delete()

Remember to call set_credentials(), or to set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables before making any calls.


ConnectionBorg.set_credentials(aws_access_key_id, aws_secret_access_key)

Set the DynamoDB credentials. If boto is already configured on this machine, this step is optional. Access keys can be found in Amazon’s console.

  • aws_access_key_id – AWS api access key ID
  • aws_secret_access_key – AWS api access key

Set the DynamoDB region. If this is not set AWS defaults to ‘us-east-1’.

Parameters:region_name – The name of the region to use

Create a table

ConnectionBorg.create_table(cls, read_units, write_units, wait_for_active=False)

Create a table that’ll be used to store instances of cls.

See Amazon’s developer guide for more information about provisioned throughput.

  • cls – The class whose instances will be stored in the table.
  • read_units – The number of read units to provision for this table (minimum 5)
  • write_units – The number of write units to provision for this table (minimum 5).
  • wait_for_active – If True, create_table will wait for the table to become ACTIVE before returning (otherwise, it’ll be CREATING). Note that this can take up to a minute. Defaults to False.

Project Versions

Table Of Contents

Previous topic

Change log - Migration guide.

Next topic

Migration class

This Page