You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using an object supplied from from boto3.dynamodb.conditions import Attr rather than string expression transact_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 the api_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.
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?
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: