简体   繁体   中英

Filter and scan a table DynamoDB in PHP

I have a table Client which contains information like this :

{
  "address": "XXX",
  "contact_email": "XXX",
  "id": 1,
  "password": "XXX",
}

The primary partition key is the id (Number) and I want to retrieve a client information by a contact_email using PHP.

When you query the dynamodb, partition key is must. When you scan the dynamodb, partition key is optional. But Scan is slower than Query.

Try with this

var params = {
        "TableName": tableName,
        "FilterExpression": "contact_email = :val1",
        "ExpressionAttributeValues": {
            ":val1": contact_email
        },
        "ReturnConsumedCapacity": "TOTAL"
    };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM