1
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
2
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
4
# Permission is hereby granted, free of charge, to any person obtaining a
5
# copy of this software and associated documentation files (the
6
# "Software"), to deal in the Software without restriction, including
7
# without limitation the rights to use, copy, modify, merge, publish, dis-
8
# tribute, sublicense, and/or sell copies of the Software, and to permit
9
# persons to whom the Software is furnished to do so, subject to the fol-
12
# The above copyright notice and this permission notice shall be included
13
# in all copies or substantial portions of the Software.
15
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
18
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26
:ivar table: The Table object from which the item is retrieved.
28
:ivar keys: A list of scalar or tuple values. Each element in the
29
list represents one Item to retrieve. If the schema for the
30
table has both a HashKey and a RangeKey, each element in the
31
list should be a tuple consisting of (hash_key, range_key). If
32
the schema for the table contains only a HashKey, each element
33
in the list should be a scalar value of the appropriate type
36
:ivar attributes_to_get: A list of attribute names.
37
If supplied, only the specified attribute names will
38
be returned. Otherwise, all attributes will be returned.
41
def __init__(self, table, keys, attributes_to_get=None):
44
self.attributes_to_get = attributes_to_get
46
class BatchList(list):
48
A subclass of a list object that contains a collection of
49
:class:`boto.dynamodb.batch.Batch` objects.
52
def __init__(self, layer2):
56
def add_batch(self, table, keys, attributes_to_get=None):
58
Add a Batch to this BatchList.
60
:type table: :class:`boto.dynamodb.table.Table`
61
:param table: The Table object in which the items are contained.
64
:param keys: A list of scalar or tuple values. Each element in the
65
list represents one Item to retrieve. If the schema for the
66
table has both a HashKey and a RangeKey, each element in the
67
list should be a tuple consisting of (hash_key, range_key). If
68
the schema for the table contains only a HashKey, each element
69
in the list should be a scalar value of the appropriate type
72
:type attributes_to_get: list
73
:param attributes_to_get: A list of attribute names.
74
If supplied, only the specified attribute names will
75
be returned. Otherwise, all attributes will be returned.
77
self.append(Batch(table, keys, attributes_to_get))
80
return self.layer2.batch_get_item(self)