Reputation: 3
I want to add AND kind of filter in Table.scan,
For example:
scanneditems = logTable.scan(unitid__eq='dev1',time__gte=condition1 and time__lt=condition2)
I need items with time greater than condition1 but less than condition2, how do I add AND type of condition here?
Thank you in advance.
Upvotes: 0
Views: 1040
Reputation: 491
If you want to place two conditions on the same AttributeName, FilterExpression's are the way to go. Here is a snippet a code from boto 2.34 demonstrating your filter above.
# db in this case represents the boto.dynamodb2.layer1.DynamoDBConnection object
db.scan(<Your Table>, filter_expression="unitid = :a AND time > :b AND time < :c",
expression_attribute_values={":a" : {"S": "dev1"}, ":b": <condition1>, ":c": <condition2>})
Let me know if you need anything else, thanks!
Upvotes: 1