Get all available regions for the Amazon DynamoDB service.
Return type: | list |
---|---|
Returns: | A list of boto.regioninfo.RegionInfo |
This is the lowest-level interface to DynamoDB. Methods at this layer map directly to API requests and parameters to the methods are either simple, scalar values or they are the Python equivalent of the JSON input as defined in the DynamoDB Developer’s Guide. All responses are direct decoding of the JSON response bodies to Python data structures via the json or simplejson modules.
Variables: | throughput_exceeded_events – An integer variable that keeps a running total of the number of ThroughputExceeded responses this connection has received from Amazon DynamoDB. |
---|
The error response returned when a conditional check fails
The default region name for DynamoDB API.
The number of times an error is retried.
alias of DynamoDBResponseError
The name of the Service
The error response returned when session token has expired
The error response returned when provisioned throughput is exceeded
The error response returned when an item is invalid in some way
DynamoDB API version.
Return a set of attributes for a multiple items in multiple tables using their primary keys.
Parameters: | request_items (dict) – A Python version of the RequestItems data structure defined by DynamoDB. |
---|
This operation enables you to put or delete several items across multiple tables in a single API call.
Parameters: | request_items (dict) – A Python version of the RequestItems data structure defined by DynamoDB. |
---|
Add a new table to your account. The table name must be unique among those associated with the account issuing the request. This request triggers an asynchronous workflow to begin creating the table. When the workflow is complete, the state of the table will be ACTIVE.
Parameters: |
---|
Delete an item and all of it’s attributes by primary key. You can perform a conditional delete by specifying an expected rule.
Parameters: |
|
---|
Deletes the table and all of it’s data. After this request the table will be in the DELETING state until DynamoDB completes the delete operation.
Parameters: | table_name (str) – The name of the table to delete. |
---|
Returns information about the table including current state of the table, primary key schema and when the table was created.
Parameters: | table_name (str) – The name of the table to describe. |
---|
Return a set of attributes for an item that matches the supplied key.
Parameters: |
|
---|
Returns a dictionary of results. The dictionary contains a TableNames key whose value is a list of the table names. The dictionary could also contain a LastEvaluatedTableName key whose value would be the last table name returned if the complete list of table names was not returned. This value would then be passed as the start_table parameter on a subsequent call to this method.
Parameters: |
---|
Raises: | DynamoDBExpiredTokenError if the security token expires. |
---|
Create a new item or replace an old item with a new item (including all attributes). If an item already exists in the specified table with the same primary key, the new item will completely replace the old item. You can perform a conditional put by specifying an expected rule.
Parameters: |
|
---|
Perform a query of DynamoDB. This version is currently punting and expecting you to provide a full and correct JSON body which is passed as is to DynamoDB.
Parameters: |
|
---|
Perform a scan of DynamoDB. This version is currently punting and expecting you to provide a full and correct JSON body which is passed as is to DynamoDB.
Parameters: |
|
---|
Edits an existing item’s attributes. You can perform a conditional update (insert a new attribute name-value pair if it doesn’t exist, or replace an existing name-value pair if it has certain expected attribute values).
Parameters: |
|
---|
Return a set of attributes for a multiple items in multiple tables using their primary keys.
Parameters: | batch_list (boto.dynamodb.batch.BatchList) – A BatchList object which consists of a list of boto.dynamoddb.batch.Batch objects. Each Batch object contains the information about one batch of objects that you wish to retrieve in this request. |
---|
Performs multiple Puts and Deletes in one batch.
Parameters: | batch_list (boto.dynamodb.batch.BatchWriteList) – A BatchWriteList object which consists of a list of boto.dynamoddb.batch.BatchWrite objects. Each Batch object contains the information about one batch of objects that you wish to put or delete. |
---|
Build a Key structure to be used for accessing items in Amazon DynamoDB. This method takes the supplied hash_key and optional range_key and validates them against the schema. If there is a mismatch, a TypeError is raised. Otherwise, a Python dict version of a Amazon DynamoDB Key data structure is returned.
Parameters: |
|
---|
Create a Schema object used when creating a Table.
Parameters: |
|
---|
Create a new Amazon DynamoDB table.
Parameters: |
|
---|---|
Return type: | |
Returns: | A Table object representing the new Amazon DynamoDB table. |
Delete the item from Amazon DynamoDB.
Parameters: |
|
---|
Delete this table and all items in it. After calling this the Table objects status attribute will be set to ‘DELETING’.
Parameters: | table (boto.dynamodb.table.Table) – The Table object that is being deleted. |
---|
Retrieve information about an existing table.
Parameters: | name (str) – The name of the desired table. |
---|
Convert a set of pending item updates into the structure required by Layer1.
Convert an expected_value parameter into the data structure required for Layer1.
Convert a last_evaluated_key parameter into the data structure required for Layer1.
Convert a layer2 range_key_condition parameter into the structure required by Layer1.
Convert a layer2 scan_filter parameter into the structure required by Layer1.
Retrieve an existing item from the table.
Parameters: |
|
---|
Retrieve the Table object for an existing table.
Parameters: | name (str) – The name of the desired table. |
---|---|
Return type: | boto.dynamodb.table.Table |
Returns: | A Table object representing the table. |
Return a list of the names of all tables associated with the current account and region.
Parameters: | limit (int) – The maximum number of tables to return. |
---|
Retrieve the Table object for an existing table.
Parameters: | name (str) – The name of the desired table. |
---|---|
Return type: | boto.dynamodb.table.Table |
Returns: | A Table object representing the table. |
Return a new, empty boto.dynamodb.batch.BatchList object.
Return a new, empty boto.dynamodb.batch.BatchWriteList object.
Store a new item or completely replace an existing item in Amazon DynamoDB.
Parameters: |
|
---|
Perform a query on the table.
Parameters: |
|
---|---|
Return type: |
Perform a scan of DynamoDB.
Parameters: |
|
---|---|
Return type: |
Create a Table object from a schema.
This method will create a Table object without making any API calls. If you know the name and schema of the table, you can use this method instead of get_table.
Example usage:
table = layer2.table_from_schema(
'tablename',
Schema.create(hash_key=('foo', 'N')))
Parameters: |
|
---|---|
Return type: | |
Returns: | A Table object representing the table. |
Commit pending item updates to Amazon DynamoDB.
Parameters: |
|
---|
Update the ProvisionedThroughput for the Amazon DynamoDB Table.
Parameters: |
|
---|
Use the decimal.Decimal type for encoding/decoding numeric types.
By default, ints/floats are used to represent numeric types (‘N’, ‘NS’) received from DynamoDB. Using the Decimal type is recommended to prevent loss of precision.
This is an object that wraps up the table_generator function. The only real reason to have this is that we want to be able to accumulate and return the ConsumedCapacityUnits element that is part of each response.
Variables: |
|
---|
Returns a float representing the ConsumedCapacityUnits accumulated.
The total number of items retrieved thus far. This value changes with iteration and even when issuing a call with count=True, it is necessary to complete the iteration to assert an accurate count value.
Issue a call and return the result. You can invoke this method while iterating over the TableGenerator in order to skip to the next “page” of results.
The current response to the call from DynamoDB.
As above, but representing the total number of items scanned by DynamoDB, without regard to any filters.
An Amazon DynamoDB table.
Variables: |
|
---|---|
Parameters: |
|
Return a set of attributes for a multiple items from a single table using their primary keys. This abstraction removes the 100 Items per batch limitations as well as the “UnprocessedKeys” logic.
Parameters: |
|
---|---|
Returns: | A TableBatchGenerator (generator) object which will iterate over all results |
Return type: |
Create a Table object.
If you know the name and schema of your table, you can create a Table object without having to make any API calls (normally an API call is made to retrieve the schema of a table).
Example usage:
table = Table.create_from_schema(
boto.connect_dynamodb(),
'tablename',
Schema.create(hash_key=('keyname', 'N')))
Parameters: |
|
---|---|
Return type: | |
Returns: | A Table object representing the table. |
Delete this table and all items in it. After calling this the Table objects status attribute will be set to ‘DELETING’.
Retrieve an existing item from the table.
Parameters: |
|
---|
Checks the table to see if the Item with the specified hash_key exists. This may save a tiny bit of time/bandwidth over a straight get_item() if you have no intention to touch the data that is returned, since this method specifically tells Amazon not to return anything but the Item’s key.
Parameters: |
|
---|---|
Return type: | bool |
Returns: | True if the Item exists, False if not. |
Retrieve an existing item from the table.
Parameters: |
|
---|
Return an new, unsaved Item which can later be PUT to Amazon DynamoDB.
This method has explicit (but optional) parameters for the hash_key and range_key values of the item. You can use these explicit parameters when calling the method, such as:
>>> my_item = my_table.new_item(hash_key='a', range_key=1,
attrs={'key1': 'val1', 'key2': 'val2'})
>>> my_item
{u'bar': 1, u'foo': 'a', 'key1': 'val1', 'key2': 'val2'}
Or, if you prefer, you can simply put the hash_key and range_key in the attrs dictionary itself, like this:
>>> attrs = {'foo': 'a', 'bar': 1, 'key1': 'val1', 'key2': 'val2'}
>>> my_item = my_table.new_item(attrs=attrs)
>>> my_item
{u'bar': 1, u'foo': 'a', 'key1': 'val1', 'key2': 'val2'}
The effect is the same.
Parameters: |
|
---|
Perform a query on the table.
Parameters: |
|
---|
Refresh all of the fields of the Table object by calling the underlying DescribeTable request.
Parameters: |
|
---|
Scan through this table, this is a very long and expensive operation, and should be avoided if at all possible.
Parameters: |
|
---|---|
Returns: | A TableGenerator (generator) object which will iterate over all results |
Return type: |
Update the state of the Table object based on the response data received from Amazon DynamoDB.
Update the ProvisionedThroughput for the Amazon DynamoDB Table.
Parameters: |
---|
A low-level generator used to page through results from batch_get_item operations.
Variables: | consumed_units – An integer that holds the number of ConsumedCapacityUnits accumulated thus far for this generator. |
---|
Represents a DynamoDB schema.
Variables: |
|
---|
Convenience method to create a schema object.
Example usage:
schema = Schema.create(hash_key=('foo', 'N'))
schema2 = Schema.create(hash_key=('foo', 'N'),
range_key=('bar', 'S'))
Parameters: |
|
---|
An item in Amazon DynamoDB.
Variables: |
|
---|
Queue the addition of an attribute to an item in DynamoDB. This will eventually result in an UpdateItem request being issued with an update action of ADD when the save method is called.
Parameters: |
|
---|
Delete the item from DynamoDB.
Parameters: |
|
---|
Queue the deletion of an attribute from an item in DynamoDB. This call will result in a UpdateItem request being issued with update action of DELETE when the save method is called.
Parameters: |
---|
Store a new item or completely replace an existing item in Amazon DynamoDB.
Parameters: |
|
---|
Queue the putting of an attribute to an item in DynamoDB. This call will result in an UpdateItem request being issued with the update action of PUT when the save method is called.
Parameters: |
|
---|
Commits pending updates to Amazon DynamoDB.
Parameters: |
|
---|
Used to construct a BatchGet request.
Variables: |
|
---|
Convert the Batch object into the format required for Layer1.
A subclass of a list object that contains a collection of boto.dynamodb.batch.Batch objects.
Add a Batch to this BatchList.
Parameters: |
|
---|
Resubmit the batch to get the next result set. The request object is rebuild from scratch meaning that all batch added between submit and resubmit will be lost.
Note: This method is experimental and subject to changes in future releases
Convert a BatchList object into format required for Layer1.
Used to construct a BatchWrite request. Each BatchWrite object represents a collection of PutItem and DeleteItem requests for a single Table.
Variables: |
|
---|
Convert the Batch object into the format required for Layer1.
A subclass of a list object that contains a collection of boto.dynamodb.batch.BatchWrite objects.
Add a BatchWrite to this BatchWriteList.
Parameters: |
|
---|
Convert a BatchWriteList object into format required for Layer1.
Some utility functions to deal with mapping Amazon DynamoDB types to Python types and vice-versa.
Control serialization/deserialization of types.
This class controls the encoding of python types to the format that is expected by the DynamoDB API, as well as taking DynamoDB types and constructing the appropriate python types.
If you want to customize this process, you can subclass this class and override the encoding/decoding of specific types. For example:
'foo' (Python type)
|
v
encode('foo')
|
v
_encode_s('foo')
|
v
{'S': 'foo'} (Encoding sent to/received from DynamoDB)
|
V
decode({'S': 'foo'})
|
v
_decode_s({'S': 'foo'})
|
v
'foo' (Python type)
Takes the format returned by DynamoDB and constructs the appropriate python type.
Encodes a python type to the format expected by DynamoDB.
Use float/int instead of Decimal for numeric types.
This class is provided for backwards compatibility. Instead of using Decimals for the ‘N’, ‘NS’ types it uses ints/floats.
This class is deprecated and its usage is not encouraged, as doing so may result in loss of precision. Use the Dynamizer class instead.
Take a scalar Python value and return a dict consisting of the Amazon DynamoDB type specification and the value that needs to be sent to Amazon DynamoDB. If the type of the value is not supported, raise a TypeError
Take a scalar Python value and return a string representing the corresponding Amazon DynamoDB type. If the value passed in is not a supported type, raise a TypeError.
A custom object hook for use when decoding JSON item bodys. This hook will transform Amazon DynamoDB JSON responses to something that maps directly to native Python types.
Cast a number to a string and perform validation to ensure no loss of precision.