Fix DynamoDb2 ExpressionAttributeNames can start with a number (#3206)

When using pynamodb's support for transactions it makes use of of
ExpressionAttributeNames that look like #0 #1 etc. According to

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeNames.html

And when testing against dynamodb-local these work without issue,
however, when testing with moto they fail.
This commit is contained in:
Iain Bullard 2020-07-31 17:46:48 +01:00 committed by GitHub
commit 88a1134657
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -109,7 +109,7 @@ class ExpressionTokenizer(object):
@classmethod
def is_expression_attribute(cls, input_string):
return re.compile("^[a-zA-Z][a-zA-Z0-9_]*$").match(input_string) is not None
return re.compile("^[a-zA-Z0-9][a-zA-Z0-9_]*$").match(input_string) is not None
@classmethod
def is_expression_attribute_name(cls, input_string):