Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DynamoDb2 ExpressionAttributeNames can start with a number #3206

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

iainb
Copy link
Contributor

@iainb iainb commented Jul 31, 2020

When using pynamodb's support for transactions it makes use of of ExpressionAttributeNames that look like #0 #1 etc. According to the ExpressionAttributeName documentation and when testing against dynamodb-local these names work. However, when testing with moto they fail.

This PR modifies the regex for an expression attribute to allow for names that start with a number. This fix allows for tests in my codebase to pass.

As an aside - when reading the documentation it specifies that ExpressionAttributeNames must be alphanumeric, however, looking at the regex and moto tests _ appears to be used. Possibly I'm slightly confused or this regex is used in multiple places??

When using pynamodb's support for transactions it makes use of of
ExpressionAttributeNames that look like #0 getmoto#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.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.001%) to 94.338% when pulling b2b316a on iainb:dynamodb2-fix-update into a9ac099 on spulec:master.

Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @iainb!

@bblommers
Copy link
Collaborator

The underscore is probably another bug - will merge this for now.

@bblommers bblommers merged commit 88a1134 into getmoto:master Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants