From 6ea60012fc790764fe19d2d3d961298a370e62b3 Mon Sep 17 00:00:00 2001 From: Ilya Shmygol Date: Thu, 21 Nov 2019 13:02:27 +0100 Subject: [PATCH] Improve parsing DynamoDB begins_with expression A query fails if it has a space between `begins_with` and `(`, for example: ```begins_with (#1, :1)``` Fix #1996 --- moto/dynamodb2/responses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moto/dynamodb2/responses.py b/moto/dynamodb2/responses.py index 0e39a1da..c6dd094a 100644 --- a/moto/dynamodb2/responses.py +++ b/moto/dynamodb2/responses.py @@ -481,7 +481,7 @@ class DynamoHandler(BaseResponse): ] elif "begins_with" in range_key_expression: range_comparison = "BEGINS_WITH" - range_values = [value_alias_map[range_key_expression_components[1]]] + range_values = [value_alias_map[range_key_expression_components[-1]]] else: range_values = [value_alias_map[range_key_expression_components[2]]] else: