Open
Description
Hi,
I am receiving the following error
ValueError: No hash key attribute for index: fetch_index
Although I followed instructions as in the example
Here is the model class
class ArticleModel(Model):
"""
Article model in DeynamoDB
"""
@classmethod
def _conditional_operator_check(cls, conditional_operator):
pass
class Meta:
table_name = app_config.articles_table
region = app_config.REGION
aws_access_key_id = app_config.AWS_KEY,
aws_secret_access_key = app_config.AWS_SECRET,
key = UnicodeAttribute(hash_key=True)
domain = UnicodeAttribute(null=False)
publish_date = UTCDateTimeAttribute()
fetch_date = UnicodeAttribute(null=False)
fetch_time = UnicodeAttribute(null=False)
lang = UnicodeAttribute(null=False)
fetch_index = FetchIndex()
And here is the index class
class FetchIndex(GlobalSecondaryIndex):
"""
Fetch Index Secondary index for Articles table
"""
class Meta:
read_capacity_units = 2
write_capacity_units = 1
index_name = 'fetch_index'
projection = AllProjection()
fetch_date = UnicodeAttribute(hash_key=True)
fetch_time = UnicodeAttribute(range_key=True)
Here is my query
for article in ArticleModel.fetch_index.query("2017-07-21"):
print("Item queried from index: {0}".format(article.key))
Note: The global index has been created via web console with same names for hash and sort keys