Backed, of course, by a new is_hunt attribute.
The rationale here is that the whole point of this index is to be a
sparse attribute so that the code can efficiently query all existing
hunts. But meanwhile, it's useful for puzzles to have a "hunt_id"
attribute, which would confict with the goal of having "hunt_id" be
sparse and populated only for hunts and not puzzles.
So the fix here is to make hunt_id universal, and instead have a
separate "is_hunt" attribute which is the sparse one, (and will
clearly never be populated for a puzzle).
# Behave cleanly if there is no "turbot" table at all yet.
try:
response = turb.table.scan(
# Behave cleanly if there is no "turbot" table at all yet.
try:
response = turb.table.scan(
- IndexName="hunt_id_index",
+ IndexName="is_hunt_index",
)
hunts = response['Items']
except Exception:
)
hunts = response['Items']
except Exception:
{'AttributeName': 'PK', 'AttributeType': 'S'},
{'AttributeName': 'SK', 'AttributeType': 'S'},
{'AttributeName': 'channel_id', 'AttributeType': 'S'},
{'AttributeName': 'PK', 'AttributeType': 'S'},
{'AttributeName': 'SK', 'AttributeType': 'S'},
{'AttributeName': 'channel_id', 'AttributeType': 'S'},
- {'AttributeName': 'hunt_id', 'AttributeType': 'S'},
+ {'AttributeName': 'is_hunt', 'AttributeType': 'S'},
],
ProvisionedThroughput={
'ReadCapacityUnits': 5,
],
ProvisionedThroughput={
'ReadCapacityUnits': 5,
- 'IndexName': 'hunt_id_index',
+ 'IndexName': 'is_hunt_index',
- {'AttributeName': 'hunt_id', 'KeyType': 'HASH'}
+ {'AttributeName': 'is_hunt', 'KeyType': 'HASH'}
],
'Projection': {
'ProjectionType': 'ALL'
],
'Projection': {
'ProjectionType': 'ALL'
item={
"PK": "hunt-{}".format(hunt_id),
"SK": "hunt-{}".format(hunt_id),
item={
"PK": "hunt-{}".format(hunt_id),
"SK": "hunt-{}".format(hunt_id),
"hunt_id": hunt_id,
"channel_id": channel_id,
"active": False,
"hunt_id": hunt_id,
"channel_id": channel_id,
"active": False,