UpdateItem Dynamodb Boto3 说错误查询
UpdateItem Dynamodb Boto3 Says Wrong Query
我正在尝试增加特定列的值。
我正在使用 Boto3。
update_query = '#clicks.#OS.#os = #clicks.#OS.#os + :inc, #clicks.#Brands.#brand = #clicks.#Brands.#brand + :inc, #clicks.#RAMs.#ram = #clicks.#RAMs.#ram + :inc'
table_urls.update_item(
Key={
'urlid': urlid
},
UpdateExpression=update_query,
ExpressionAttributeValues={
':inc' : Decimal(1)
},
ExpressionAttributeNames={
"#os" : os,
"#brand": brand,
"#ram" : ram,
"#clicks": "clicks",
"#OS" : "OS",
"#Brands": "Brands",
"#RAMs" : "RAMs"
},
ReturnValues='NONE'
)
这是错误堆栈跟踪:
错误:
An error occurred (ValidationException) when calling the UpdateItem operation: Invalid UpdateExpression: Syntax error; token: "#clicks", near: "#clicks."
QUERY::>> #clicks.#OS.#os = #clicks.#OS.#os + :inc, #clicks.#Brands.#brand = #clicks.#Brands.#brand + :inc, #clicks.#RAMs.#ram = #clicks.#RAMs.#ram + :inc
尝试在 update_query 字符串的开头添加 SET
。一切休息似乎都正常。
update_query = 'SET #clicks.#OS.#os = #clicks.#OS.#os + :inc, #clicks.#Brands.#brand = #clicks.#Brands.#brand + :inc, #clicks.#RAMs.#ram = #clicks.#RAMs.#ram + :inc'
table_urls.update_item(
Key={
'urlid': urlid
},
UpdateExpression=update_query,
ExpressionAttributeValues={
':inc' : Decimal(1)
},
ExpressionAttributeNames={
"#os" : os,
"#brand": brand,
"#ram" : ram,
"#clicks": "clicks",
"#OS" : "OS",
"#Brands": "Brands",
"#RAMs" : "RAMs"
},
ReturnValues='NONE'
)
我正在尝试增加特定列的值。 我正在使用 Boto3。
update_query = '#clicks.#OS.#os = #clicks.#OS.#os + :inc, #clicks.#Brands.#brand = #clicks.#Brands.#brand + :inc, #clicks.#RAMs.#ram = #clicks.#RAMs.#ram + :inc'
table_urls.update_item(
Key={
'urlid': urlid
},
UpdateExpression=update_query,
ExpressionAttributeValues={
':inc' : Decimal(1)
},
ExpressionAttributeNames={
"#os" : os,
"#brand": brand,
"#ram" : ram,
"#clicks": "clicks",
"#OS" : "OS",
"#Brands": "Brands",
"#RAMs" : "RAMs"
},
ReturnValues='NONE'
)
这是错误堆栈跟踪: 错误:
An error occurred (ValidationException) when calling the UpdateItem operation: Invalid UpdateExpression: Syntax error; token: "#clicks", near: "#clicks."
QUERY::>> #clicks.#OS.#os = #clicks.#OS.#os + :inc, #clicks.#Brands.#brand = #clicks.#Brands.#brand + :inc, #clicks.#RAMs.#ram = #clicks.#RAMs.#ram + :inc
尝试在 update_query 字符串的开头添加 SET
。一切休息似乎都正常。
update_query = 'SET #clicks.#OS.#os = #clicks.#OS.#os + :inc, #clicks.#Brands.#brand = #clicks.#Brands.#brand + :inc, #clicks.#RAMs.#ram = #clicks.#RAMs.#ram + :inc'
table_urls.update_item(
Key={
'urlid': urlid
},
UpdateExpression=update_query,
ExpressionAttributeValues={
':inc' : Decimal(1)
},
ExpressionAttributeNames={
"#os" : os,
"#brand": brand,
"#ram" : ram,
"#clicks": "clicks",
"#OS" : "OS",
"#Brands": "Brands",
"#RAMs" : "RAMs"
},
ReturnValues='NONE'
)