boto3
boto3 copied to clipboard
DynamoDB ExpressionAttributeValues Description Mismatch for Resource Methods
Describe the issue
Documentation for DynamoDB ExpressionAttributeValues description is incorrect for resource calls.
Example: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Table.delete_item
Syntax shows
ExpressionAttributeValues={
'string': 'string'|123|Binary(b'bytes')|True|None|set(['string'])|set([123])|set([Binary(b'bytes')])|[]|{}
}
but the description of ExpressionAttributeValues says
ExpressionAttributeValues (dict) -- One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued You would first need to specify ExpressionAttributeValues as follows:
{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
Links
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Table.delete_item
Hi @CoshUS,
Thanks for writing. I'm not sure what you're indicating the mismatch is. The text starting from "One or more values that can be substituted in an expression" comes directly from the API documentation:
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html#DDB-DeleteItem-request-ExpressionAttributeValues
Can you give an example of why the documentation is incorrect? Thanks!
For DynamoDB client, the documentation directly from API makes sense since the call would be
dynamodb_client.delete_item(ExpressionAttributeValues={":key" : {"S": {"val"} } }
but for DynamoDB table resource, the call should be
dynamodb_client.delete_item(ExpressionAttributeValues={":key" : "val" } }
without "S" indicating the type.
However, for both client and resource, the documentation is the same which says
You would first need to specify ExpressionAttributeValues as follows: { ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }\
This is confusing as table resource does not use the format of { ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
Checking in - I think this issue may actually be a duplicate of https://github.com/boto/boto3/issues/3198. Can you please confirm or let us know if there are any distinctions you'd like to make between these issues?
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.