-
Notifications
You must be signed in to change notification settings - Fork 893
DynamoDbEnhanced queries fail on attributes that contain +
sign.
#3058
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
Comments
@debora-ito 2.17.131. We update to the latest git version every week. |
12 tasks
|
aws-sdk-java-automation
added a commit
that referenced
this issue
Jun 6, 2024
…b0fe0cf91 Pull request: release <- staging/600c2bf2-e7eb-4b07-b1da-d66b0fe0cf91
This was referenced Oct 18, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Describe the bug
Queries on attribute names that contain
+
sign (for exampleFirstName+LastName
) fail when using the DynamoDbEnhanced client.Expected behavior
Querying on attribute names that contain
+
sign should be possible.Current behavior
Users get the following exception
Steps to Reproduce
Create a table
Run a query with a key that includes + sign. Example
The outcome will be
The same applies for the attribute values key. In that case the exception will be
Note, the example I was running was on a GSI but I think the same would apply on any query.
Possible Solution
The EnhancedDynamoDbClient uses
"#AMZN_MAPPED_" + cleanAttributeName(<attributeName>)"
and":#AMZN_MAPPED_" + cleanAttributeName(<attributeName>)"
as placeholders in query expressions.https://github.com/aws/aws-sdk-java-v2/blob/584ccb59e770177aeaa4c3b6bda4e24015b8ece9/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/internal/conditional/EqualToConditional.java
+
does not seem to be allowed in those keys.The
cleanAttributeName
method should also escape+
signs.https://github.com/aws/aws-sdk-java-v2/blob/584ccb59e770177aeaa4c3b6bda4e24015b8ece9/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/internal/EnhancedClientUtils.java
Note: The same method is also used for projection expressions. My guess is that also does not allow
+
signs but I have not tested.https://github.com/aws/aws-sdk-java-v2/blob/6eb75be0be780319e491e2f37a61c83d33a58885/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/internal/ProjectionExpression.java
Context
We had to recreate our table and GSIs as to not use + in the attribute names. We replaced them with #.
AWS Java SDK version used
2.0
JDK version used
JDK 11
Operating System and version
Any
The text was updated successfully, but these errors were encountered: