Merge pull request #414 from 2mf/master

DynamoDB2 is overwriting the table instead of returning an error
This commit is contained in:
Steve Pulec 2015-09-19 09:05:08 -04:00
commit bee2b5a891
2 changed files with 8 additions and 1 deletions

View File

@ -336,6 +336,8 @@ class DynamoDBBackend(BaseBackend):
self.tables = OrderedDict()
def create_table(self, name, **params):
if name in self.tables:
return None
table = Table(name, **params)
self.tables[name] = table
return table

View File

@ -100,12 +100,17 @@ class DynamoHandler(BaseResponse):
attr = body["AttributeDefinitions"]
# getting the indexes
global_indexes = body.get("GlobalSecondaryIndexes", [])
table = dynamodb_backend2.create_table(table_name,
schema=key_schema,
throughput=throughput,
attr=attr,
global_indexes=global_indexes)
return dynamo_json_dump(table.describe)
if table is not None:
return dynamo_json_dump(table.describe)
else:
er = 'com.amazonaws.dynamodb.v20111205#ResourceInUseException'
return self.error(er)
def delete_table(self):
name = self.body['TableName']