My test setup looks like the following:
@mock_dynamodb2
def test_name(self, dynamodb_connection):
create_table(dynamodb_connection)
table = dynamodb_connection.Table(os.environ["table"])
table.put_item(Item=create_item())
items = get_items()
The following record is stored:
When invoking the following query locally, in a mocked environment, the result is returned:
get_table("table").query(
IndexName="org-index",
KeyConditionExpression=Key("org").eq(org),
FilterExpression=Attr("status").gte(0) & Attr("status").lte(10)
The same code in AWS production will return 0 results. Changing the query to use the between
attribute instead (Attr("status").between(0, 10)
) works on DynamoDB in the cloud, but does not work locally. I'd hate to merge test with prod code by doing a check. Is there something I am overlooking?
There was a bug with between(0, 10)
where the 0 was treated as a no-value.
This has been fixed just now, as of moto >= 2.2.14.dev25.