[dynamodb2] adds lookup method to Table class
includes additional test coverage
This commit is contained in:
parent
be5f041416
commit
f03ded7e90
2 changed files with 30 additions and 0 deletions
|
|
@ -288,6 +288,16 @@ class Table(object):
|
|||
results.append(result)
|
||||
return results, scanned_count, last_page
|
||||
|
||||
def lookup(self, *args, **kwargs):
|
||||
if not self.schema:
|
||||
self.describe()
|
||||
for x, arg in enumerate(args):
|
||||
kwargs[self.schema[x].name] = arg
|
||||
ret = self.get_item(**kwargs)
|
||||
if not ret.keys():
|
||||
return None
|
||||
return ret
|
||||
|
||||
|
||||
class DynamoDBBackend(BaseBackend):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue