Rei*_*eid 0 amazon-dynamodb boto3 aws-lambda
我正在尝试使用以下代码,但无法使其正常工作。即使我完全按照文档中的说明进行操作,也会不断给我关于过滤器表达式类型错误的错误消息。我该怎么做才能解决此问题?
def EndpointDeleted(event):
endpoint = event['Attributes']['EndpointArn']
if('EndpointArn' in event['Attributes']):
client = boto3.client('dynamodb')
response = client.scan(
TableName='sniffergps-mobilehub-812282467-Users',
Select='ALL_ATTRIBUTES',
FilterExpression=Attr('Endpoints').contains(endpoint)
)
return responseRun Code Online (Sandbox Code Playgroud)
但是我收到一个错误消息,说过滤器表达式是错误的类型。我有以下导入消息:
import boto3
from boto3.dynamodb.conditions import Key
from boto3.dynamodb.conditions import Attr
错误信息:
{
"errorMessage": "Parameter validation failed:\nInvalid type for parameter FilterExpression, value: <boto3.dynamodb.conditions.Contains object at 0x7fdca25e0b38>, type: <class 'boto3.dynamodb.conditions.Contains'>, valid types: <class 'str'>",
"errorType": "ParamValidationError",
"stackTrace": [
[
"/var/task/lambda_function.py",
13,
"lambda_handler",
"return EndpointDeleted(event)"
],
[
"/var/task/lambda_function.py",
24,
"EndpointDeleted",
"FilterExpression=Attr('Endpoints').contains(endpoint)"
],
[
"/var/runtime/botocore/client.py",
312,
"_api_call",
"return self._make_api_call(operation_name, kwargs)"
],
[
"/var/runtime/botocore/client.py",
575,
"_make_api_call",
"api_params, operation_model, context=request_context)"
],
[
"/var/runtime/botocore/client.py",
630,
"_convert_to_request_dict",
"api_params, operation_model)"
],
[
"/var/runtime/botocore/validate.py",
291,
"serialize_to_request",
"raise ParamValidationError(report=report.generate_report())"
]
]
}Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2629 次 |
| 最近记录: |