I'm looking for a way to create a scan request in Dynamodb with multiple FilterExpression conditions "ANDed" together.
For example, we could scan a "fruit" database using this criteria:
criteria = {
'fruit': 'apple',
'color': 'green',
'taste': 'sweet'
}
I understand these could be concatenated into a string like so:
FilterExpression = ' AND '.join([f"{k}=:{k}" for k, v in criteria.items()])
ExpressionAttributeValues = {f":{k}": {'S': v} for k, v in criteria.items()}
However this does not seem like the most elegant / pythonic approach.