jeudi 2 juillet 2015

DynamoDB - GetItem request not working

I have a table named "genres" in DynamoDB.

It has two items so far:

| language (Hash Key) | name (Range Key)        |
-------------------------------------------------
| S: "en"             | S: "Comedy"             |
-------------------------------------------------
| S: "es"             | S: "Comedia"            |

I'm using AWSSDK 2.3.44.0 for .NET:

GetItemRequest request = new GetItemRequest();
request.TableName = "genres";
request.Key = new Dictionary<string, AttributeValue>()
{
     { "language", new AttributeValue() { S = "en" } },
     { "name", new AttributeValue() { S = "Comedy" } }
}
GetItemResponse response = await _dbClient.GetItemAsync(request);

As you can see I am filling all the required information to complete the operation. And in fact, it seems it does so, because no exception is thrown.

However, after inspecting my response variable, I see that response.Item is empty, as if it didn't find the item in my table, even if all the keys are correct.

I know that maybe language and name are reserved words, so I tried using Expression Attribute Names to create the aliases, but the expression names can only be used in expressions, and not in key conditions.

What's happening here?




Aucun commentaire:

Enregistrer un commentaire