turb.table = turb.db.create_table(
TableName='turbot',
KeySchema=[
- {'AttributeName': 'PK', 'KeyType': 'HASH'},
+ {'AttributeName': 'hunt_id', 'KeyType': 'HASH'},
{'AttributeName': 'SK', 'KeyType': 'RANGE'},
],
AttributeDefinitions=[
- {'AttributeName': 'PK', 'AttributeType': 'S'},
+ {'AttributeName': 'hunt_id', 'AttributeType': 'S'},
{'AttributeName': 'SK', 'AttributeType': 'S'},
{'AttributeName': 'channel_id', 'AttributeType': 'S'},
{'AttributeName': 'is_hunt', 'AttributeType': 'S'},
# (leaving it as non-active for now until the channel-created handler
# finishes fixing it up with a sheet and a companion table)
item={
- "PK": "hunt-{}".format(hunt_id),
+ "hunt_id": hunt_id,
"SK": "hunt-{}".format(hunt_id),
"is_hunt": hunt_id,
- "hunt_id": hunt_id,
"channel_id": channel_id,
"active": False,
"name": name,
"""
turbot_table = turb.db.Table("turbot")
- response = turbot_table.get_item(Key={'PK': 'hunt-{}'.format(hunt_id)})
+ response = turbot_table.get_item(Key={'hunt_id': hunt_id})
if 'Item' in response:
return response['Item']
# Insert the newly-created puzzle into the database
item={
- "PK": "hunt-{}".format(hunt_id),
+ "hunt_id": hunt_id,
"SK": "puzzle-{}".format(puzzle_id),
"puzzle_id": puzzle_id,
"channel_id": channel_id,