【发布时间】:2023-02-07 18:38:43
【问题描述】:
我正在尝试使用这样的全局索引创建 DynamoDB 表:
aws create-table \
--table-name test1 --attribute-definitions AttributeName=id,AttributeType=S AttributeName=consumerId,AttributeType=S \
--key-schema AttributeName=id,KeyType=HASH \
--global-secondary-indexes IndexName=consumerIdInd,KeySchema=[{AttributeName=consumerId,KeyType=HASH}],Projection={ProjectionType=ALL}
这将返回:
参数验证失败: 参数 GlobalSecondaryIndexes[0].KeySchema[0] 的类型无效,值:AttributeName=consumerId,类型:<class 'str'>,有效类型:<class 'dict'> 参数 GlobalSecondaryIndexes[1].KeySchema[0] 的类型无效,值:KeyType=HASH,类型:<class 'str'>,有效类型:<class 'dict'>
如何解决这个问题?
【问题讨论】:
标签: amazon-web-services amazon-dynamodb