将DynamoDB中的Projection表达式设置为排除列。

huangapple go评论79阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年5月5日 03:10:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/61599796.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定