-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Dynamodb transact_write_items throws a exception validating ConditionExpression #4053
Comments
I've created an example pull request that would fix this. I am not attached to it, it's just a suggestion and I'm happy to throw it away it the maintainers don't like it. I do wonder however why all the expressions are not unpacked during the recursion like in my change, rather than putting just one of the transforms attributes there and then storing placeholders for later? |
Thanks for reaching out and your patience here. I'm not fully clear on the issue here and think we need some more information. Both code snippets you provided fail with the error: Can you provide new code snippets highlighting the issue and what you're trying to do? Adding debug logs using |
Ooops, sorry about that, I foolishly used a resource instead of a client in the example. I've updated the example to use the client and tested the snippet to check it gives the error I've reported. |
Hopefully my example change and test in the linked PR should give you insight into where in the code the issue is. |
Describe the bug
When using an object supplied from
from boto3.dynamodb.conditions import Attr
rather than string expressiontransact_write_items
raises an exception:Unknown parameter in input: "ExpressionAttributeNames", must be one of: TransactItems, ReturnConsumedCapacity, ReturnItemCollectionMetrics, ClientRequestToken
When a
ConditionExpression
is supplied for a put.Expected Behavior
I expect the transact_write_items call to function the same where the string representation of a ConditionExpression is supplied or the python object is supplied.
Current Behavior
The string expression works as expected, whereas when using the Attr object, the
inject_condition_expressions
function unpacks theapi_params
into:Note how the
ExpressionAttributeNames
is now outside the item and is validated as part of the top level members which causes the "Unknown parameter in input" exception.Reproduction Steps
Example:
Works:
Same action using the Attr object does not work:
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.34.65
Environment details (OS name and version, etc.)
Ubuntu 22.04, python 3.11
The text was updated successfully, but these errors were encountered: