I have a table in Dynamo Db with 2 million records. The table has date (yyyy-mm-dd) as partition key and account I'd as sort key. Currently, we are using boto3.client.dynamodb.query to fetch the data based on KeyConditionExpression where X is date. I want to query the records based on just year? What should KeyConditionExpression and Expression Attribute Values be?
Sample row in Dynamo Db :
{"date": {"s" : "2022-04-29"},"account_id": {"s" :"6208378688923445"}}
Here date is partition key and account_id is sort key. I want to query all the records with year 2022.