我是dynamoDB的新手,正在努力填充我的DynamoDB表格。我已经定义了这个表格如下:
$response = $DynamoDb->createTable([
'TableName' => 'products',
'AttributeDefinitions' => [
[
'AttributeName' => 'product_code',
'AttributeType' => 'N'
],
[
'AttributeName' => 'created_at',
'AttributeType' => 'N'
],
],
'KeySchema' => [
[
'AttributeName' => 'product_code',
'KeyType' => 'HASH'
],
[
'AttributeName' => 'created_at',
'KeyType' => 'RANGE'
]
],
'ProvisionedThroughput' => [
'ReadCapacityUnits' => 5,
'WriteCapacityUnits' => 6
]
]);
并使用以下内容进行填充
$result = $DynamoDb->putItem([
'TableName' => 'products',
'Item' => [
'product_code' => ['N' => (int)$row[0]],
'created_at' => ['N' => (int)strtotime("now")]
]
]);
I keep getting the error
Integer can not be converted to an String
请问有谁能给新手一些建议。非常感谢。