小编use*_*546的帖子

DynamoDB 使用排序键对数据进行排序不起作用

我正在使用 dynamoDb 来存储一些额外的信息,但我在整理数据时遇到了一些麻烦。

我有以下创建语法,其中有 astoreIdnumber键。我将numberas 排序键设置为排序键,但问题是数据根本没有排序。

$response = $dynamoDb->createTable([
    'TableName' => 'foo',
    'KeySchema' => [
        [
            'AttributeName' => 'storeId',
            'KeyType' => 'HASH'  //Partition key
        ],
        [
            'AttributeName' => 'number',
            'KeyType' => 'RANGE' // sort Key
        ]
    ],
    'AttributeDefinitions' => [
        [
            'AttributeName' => 'storeId',
            'AttributeType' => 'N'
        ],
        [
            'AttributeName' => 'number',
            'AttributeType' => 'N'
        ]
    ],
    'ProvisionedThroughput' => [
        'ReadCapacityUnits' => 20,
        'WriteCapacityUnits' => 20
    ]
]);
Run Code Online (Sandbox Code Playgroud)

我的扫描参数:

$scanParams = [
    'TableName' => …
Run Code Online (Sandbox Code Playgroud)

sorting amazon-web-services amazon-dynamodb aws-php-sdk

1
推荐指数
1
解决办法
1万
查看次数