英文:
Set Projection expression in DynamoDB to EXCLUDE columns
问题
我正在构建 DynamoDB 查询,并希望显示除特定列之外的所有列。
我注意到可以使用投影表达式,但根据所写的内容,我们需要指定所有需要显示为结果的列。原因是因为在我们的表中指定了太多列(超过100列),无法逐个列出。
我的用例如下:
想象一个类似于以下的表:
|ID |Name |Age |Address |.....
|1 |Student1 |15 |Oak View, XYZ|.....
我的结果应该如下:
|ID |Name |Address |.....
|1 |Student1 |Oak View, XYZ|.....
在这里,我的表达式被设置为排除 'Age' 列。
请帮忙。
英文:
I am constructing queries in DynamoDB and want to display all but a particular set of columns.
I see that Projection Expressions can be used, but from what is written, we need to specify all the columns which need to be displayed as result. The reason is because there are too many columns specified in our table (more than 100) to list down individually.
My use case is like this:
Imagine a table like:
|ID |Name |Age |Address |.....
|1 |Student1 |15 |Oak View, XYZ|.....
My result should be like:
|ID |Name |Address |.....
|1 |Student1 |Oak View, XYZ|.....
Here my expression is set to exclude the 'Age' column
Please help.
答案1
得分: 1
无法在投影中明确排除属性,在实际操作中,如果您想要从10列中省略1列,最简单的方法是在代码中直接从DynamoDB的响应中删除这些列。
英文:
It is not possible to explicitly exclude attributes from projection, in practice if you want to omit 1 column out of 10 it's easier to just pop those columns from DynamoDB's response in your code.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论