boto - 由于架构不匹配,删除失败
boto - delete fails because of schema mismatch
我有一个名为 Events 的 table,以 deviceID 作为主键,以 timeStamp 作为排序键。现在我正在尝试删除给定这两个键的项目:
dynamodb = boto3.resource('dynamodb')
events_table = dynamodb.Table('Events')
events_table.delete_item(
Key = {
'deviceID' : 'xyz123',
'timeStamp' : 12314156.54345
}
)
为什么我会收到架构不匹配错误?输出如下:
File "C:\Python27\lib\site-packages\boto3\resources\factory.py", line 498, in do_action
response = action(self, *args, **kwargs)
File "C:\Python27\lib\site-packages\boto3\resources\action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "C:\Python27\lib\site-packages\botocore\client.py", line 236, in _api_call
return self._make_api_call(operation_name, kwargs)
File "C:\Python27\lib\site-packages\botocore\client.py", line 500, in _make_api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the DeleteItem operation:
The provided key element does not match the schema
client = boto3.client('dynamodb')
client.delete_item(TableName='tbl_name',
Key={
'deviceID':{'S':'xyz123'},
'timeStamp' : '12314156.54345'
})
我有一个名为 Events 的 table,以 deviceID 作为主键,以 timeStamp 作为排序键。现在我正在尝试删除给定这两个键的项目:
dynamodb = boto3.resource('dynamodb')
events_table = dynamodb.Table('Events')
events_table.delete_item(
Key = {
'deviceID' : 'xyz123',
'timeStamp' : 12314156.54345
}
)
为什么我会收到架构不匹配错误?输出如下:
File "C:\Python27\lib\site-packages\boto3\resources\factory.py", line 498, in do_action
response = action(self, *args, **kwargs)
File "C:\Python27\lib\site-packages\boto3\resources\action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "C:\Python27\lib\site-packages\botocore\client.py", line 236, in _api_call
return self._make_api_call(operation_name, kwargs)
File "C:\Python27\lib\site-packages\botocore\client.py", line 500, in _make_api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the DeleteItem operation:
The provided key element does not match the schema
client = boto3.client('dynamodb')
client.delete_item(TableName='tbl_name',
Key={
'deviceID':{'S':'xyz123'},
'timeStamp' : '12314156.54345'
})