We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using the updateBehavior tag introduced in PR on an attribute that contains a dash, a DynamoDbException is thrown.
DynamoDbException
The attributename used in the if_not_exists should use a cleaned attribute name just like the other expression values.
An exception is thrown:
software.amazon.awssdk.services.dynamodb.model.DynamoDbException: Invalid UpdateExpression: Syntax error; token: "-"
Create a StaticTableSchema with an attribute that contains a dash in it's name and has the updateBehavior(UpdateBehavior.WRITE_IF_NOT_EXISTS) tag.
StaticTableSchema
updateBehavior(UpdateBehavior.WRITE_IF_NOT_EXISTS)
.addAttribute(EnhancedType.listOf(RelatedParty.class), a -> a.name("Abc-Def") .getter(DbExpenseTransaction::getAbcDef) .setter(DbExpenseTransaction::setAbcDef) .tags(updateBehavior(UpdateBehavior.WRITE_IF_NOT_EXISTS)))
In the UpdateItemOperation class, the following code:
UpdateItemOperation
private static final Function<String, String> CONDITIONAL_UPDATE_MAPPER = key -> "if_not_exists(" + key + ", " + EXPRESSION_VALUE_KEY_MAPPER.apply(key) + ")";
should also be using the EXPRESSION_KEY_MAPPER like this:
EXPRESSION_KEY_MAPPER
private static final Function<String, String> CONDITIONAL_UPDATE_MAPPER = key -> "if_not_exists(" + EXPRESSION_KEY_MAPPER.apply(key) + ", " + EXPRESSION_VALUE_KEY_MAPPER.apply(key) + ")";
The text was updated successfully, but these errors were encountered:
I can create a PR to fix the bug if you want.
Sorry, something went wrong.
@bramvanswalm Thank you, great catch! Should be all fixed now.
Merge pull request #2087 from aws/staging/e3055947-7c4a-47e8-af6a-a04…
d16def5
…32e5dc5d1 Pull request: release <- staging/e3055947-7c4a-47e8-af6a-a0432e5dc5d1
Successfully merging a pull request may close this issue.
Describe the bug
When using the updateBehavior tag introduced in PR on an attribute that contains a dash, a
DynamoDbException
is thrown.Expected Behavior
The attributename used in the if_not_exists should use a cleaned attribute name just like the other expression values.
Current Behavior
An exception is thrown:
software.amazon.awssdk.services.dynamodb.model.DynamoDbException: Invalid UpdateExpression: Syntax error; token: "-"
Steps to Reproduce
Create a
StaticTableSchema
with an attribute that contains a dash in it's name and has theupdateBehavior(UpdateBehavior.WRITE_IF_NOT_EXISTS)
tag.Possible Solution
In the
UpdateItemOperation
class, the following code:should also be using the
EXPRESSION_KEY_MAPPER
like this:Your Environment
The text was updated successfully, but these errors were encountered: