mirror of
https://github.com/kennethreitz-archive/dynamo.git
synced 2026-06-05 23:20:18 +00:00
@@ -17,6 +17,9 @@ Usage
|
||||
|
||||
table = dynamo.table(TABLE_NAME, (ACCESS_KEY, SECRET_ACCESS_KEY))
|
||||
|
||||
# Or, if you have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY defined as
|
||||
# environment variables, you can do:
|
||||
table = dynamo.table(TABLE_NAME)
|
||||
|
||||
Writing is simple::
|
||||
|
||||
|
||||
@@ -110,14 +110,18 @@ class Item(object):
|
||||
return key in self.item
|
||||
|
||||
|
||||
def table(name, auth, eager=True):
|
||||
def table(name, auth=None, eager=True):
|
||||
"""Returns a given table for the given user."""
|
||||
auth = auth or []
|
||||
dynamodb = boto.connect_dynamodb(*auth)
|
||||
|
||||
table = dynamodb.get_table(name)
|
||||
return Table(table=table, eager=eager)
|
||||
|
||||
|
||||
def tables(auth, eager=True):
|
||||
def tables(auth=None, eager=True):
|
||||
"""Returns a list of tables for the given user."""
|
||||
auth = auth or []
|
||||
dynamodb = boto.connect_dynamodb(*auth)
|
||||
|
||||
return [table(t, auth, eager=eager) for t in dynamodb.list_tables()]
|
||||
|
||||
Reference in New Issue
Block a user