'Query DynamoDb python multiple conditions with reduce
I'm trying to make a filter expression with several keys and I don't suceed to do it, do you have any clue whats going on?
My actual code is this one:
query_args = {
'IndexName': 'ByDateIndex',
'KeyConditionExpression': And(
Key('param1').eq(params.get('param1')),
Key('date').between(params.get('date1'), params.get('date2'))
)
'FilterExpression': And(
reduce(Or, ([Key('param2').eq(val) for val in params.get('param2')])),
reduce(Or, ([Key('param3').eq(val) for val in params.get('param3')])),
reduce(Or, ([Key('param4').eq(val) for val in params.get('param4')]))
)
}
Then it seems impossible to query the data.
Thank you in advance, Best regards.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
