简体   繁体   English

使用 update_item 动态更新 dynamoDB

[英]Update dynamically dynamoDB using update_item

        UpdateExpression="set #app[idx].#st = :stVal",

I have stored the value of idx as variable.我已将 idx 的值存储为变量。 But DynamoDB throws error saying invalid 'idx'.但是 DynamoDB 抛出错误,说无效的 'idx'。

How do I use the value stored in idx in UpdateExpression.如何在 UpdateExpression 中使用存储在 idx 中的值。

The simple answer to this would be to using format strings and then replace.对此的简单答案是使用格式字符串然后替换。

    updateExp = "set #app[{}].#st = :stVal".format(idx)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM