我正在尝试使用带有过滤器的查询:
query queryPitchesByApprovedIndex($approved: Boolean = true) {
queryPitchesByApprovedIndex(approved: $approved) {
items {
id
}
}
}
AppSync制作的映射模板如下所示:
{
"version": "2017-02-28",
"operation": "Query",
"query": {
"expression": "#approved = :approved",
"expressionNames": {
"#approved": "approved",
},
"expressionValues": {
":approved": {"B": $util.dynamodb.toBinary($ctx.args.approved)},
},
},
"index": "approved-index",
"limit": $util.defaultIfNull($ctx.args.first, 20),
"nextToken": $util.toJson($util.defaultIfNullOrEmpty($ctx.args.after, null)),
"scanIndexForward": true,
"select": "ALL_ATTRIBUTES",
}
我得到的错误是:
无法解析JSON文档:'无法识别的令牌'$ util':在[Source:(String)\“ {\ n \” version处期望('true','false'或'null')\ n \“:\” 2017-02-28 \“,\ n \” operation \“:\”查询\“,\ n \”查询\“:{\ n \”表达式\“:\”#approved =:已批准\“,\ n \” expressionNames \“:{\ n \”#approved \“:\”已批准\“,\ n},\ n \” expressionValues \“:{\ n \”:approved \“: {\“ B \”:$ util.dynamodb.toBinary($ ctx.args.approved)},\ n},\ n},\ n \“ index \”:\“ approved-index \”,\ n \ “ limit \”:20,\ n \“ nextToken \”:空,\ n \“ scanIndexForward \”:是,\ n \“ select \”:\“ ALL_ATTRIBUTES \”,\ n} \“;行:10,列:31]'
有什么主意我可以解决吗?
答案 0 :(得分:1)
import win32clipboard
win32clipboard.OpenClipboard()
data = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
mytext = input(data)
keywords = ["m1", "M1", "Melding 1"]
if any(keyword in mytext for keyword in keywords):
print("test")
input('Press ENTER to exit')
以$util.dynamodb.toBinary(String data)
作为输入,但是您传递的是String
,这就是为什么评估失败的原因。
这是一个很好的反馈,我将与团队确认是否有可能使该实用程序更宽松,并且也可以使用布尔值Boolean
在此同时,这是一种可能的解决方法:
$util.dynamodb.toBinary(Boolean data)