[英]python boto3 dynamodb query function dynamic arguments
Python boto3 library dynamodb.query method. Python boto3 库 dynamodb.query 方法。 how do we pass dynamic arguments
我们如何传递动态参数
client = boto3.resource("dynamodb")
params = {
"Limit": 10,
"ExpressionAttributeNames":{"#pk":"pk"},
"ExpressionAttributeValues":{":pk":"value"},
"KeyConditionExpression":"#pk=:pk",
"ScanIndexForward": False
}
res = client.query(params)
It responds with error:它响应错误:
An error occurred (ValidationException) when calling the Query operation: Either the KeyConditions or KeyConditionExpression parameter must be specified in the request.
尝试使用 ** 正确设置参数:
res = client.query(**params)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.