2

Newbie for dynamodb and trying to get new lambda function to query table.

Can someone help me out and tell me what is wrong with the son that I am passing to the .query function. Client_ID is my hash key on the table(String)

{
    "TableName": "table1",
     "KeyConditions": {
        "Client_ID": {
            "ComparisonOperator": "EQ",
            "AttributeValueList":[
                {"S": "12345"}
            ]
        }
    }
}

When testing i get error back

"errorMessage": "Need to pass in a valid Condition Object."

1 Answer 1

1

Are you using the DynamoDB Document SDK or low level SDK? It seems like you are using the Document SDK (https://github.com/awslabs/dynamodb-document-js-sdk), in which case you should use the Condition object instead to specify the Key Conditions (i.e. KeyConditions = [docClient.Condition("Client_ID", "EQ", "12345")]) . An easier way to specify KeyConditions is to use the KeyConditionsExpression parameter instead (documented here: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditionExpression). Then your params would look like: { "TableName": "table1", "KeyConditionExpression": "Client_ID = :str", "ExpressionAttributeValues": {":str": "12345"} }

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.