zoukankan      html  css  js  c++  java
  • 投影表达式 Projection Expressions

    要从表读取数据,请使用像 GetItemQuery 或 Scan 这样的操作。默认情况下,Amazon DynamoDB 将返回所有项目属性。要仅获取部分而非全部属性,请使用投影表达式。

    投影表达式 是用于标识您需要的属性的字符串。要检索单个属性,请指定其名称。对于多个属性,必须使用逗号分隔名称。

    下面是投影表达式(基于指定项目属性中的 ProductCatalog 项目)的一些示例:

    • 单个顶级属性。

      Title

    • 三个顶级属性。DynamoDB 检索整个 Color 集。

      Title, Price, Color

    • 四个顶级属性。DynamoDB 返回 RelatedItems 和 ProductReviews 的全部内容。

      Title, Description, RelatedItems, ProductReviews

    Projection Expressions

    To read data from a table, you use operations such as GetItemQuery, or Scan. Amazon DynamoDB returns all the item attributes by default. To get only some, rather than all of the attributes, use a projection expression.

    projection expression is a string that identifies the attributes that you want. To retrieve a single attribute, specify its name. For multiple attributes, the names must be comma-separated.

    The following are some examples of projection expressions, based on the ProductCatalog item from Specifying Item Attributes:

    • A single top-level attribute.

      Title

    • Three top-level attributes. DynamoDB retrieves the entire Color set.

      Title, Price, Color

    • Four top-level attributes. DynamoDB returns the entire contents of RelatedItems and ProductReviews.

      Title, Description, RelatedItems, ProductReviews

    aws dynamodb get-item 
        --table-name ProductCatalog 
        --key file://key.json 
        --projection-expression "Description, RelatedItems[0], ProductReviews.FiveStar"
     

    条件表达式

    要操作 Amazon DynamoDB 表中的数据,请使用 PutItemUpdateItem 和 DeleteItem 操作。(您还可使用 BatchWriteItem 在单个调用中执行多个 PutItem 或 DeleteItem 操作。)

    对于这些数据处理操作,您可指定条件表达式 来确定应修改的项目。如果条件表达式的计算结果为 true,则操作成功;否则操作失败。

    Condition Expressions

    To manipulate data in an Amazon DynamoDB table, you use the PutItemUpdateItem, and DeleteItem operations. (You can also use BatchWriteItem to perform multiple PutItem or DeleteItem operations in a single call.)

    For these data manipulation operations, you can specify a condition expression to determine which items should be modified. If the condition expression evaluates to true, the operation succeeds; otherwise, the operation fails.

    aws dynamodb update-item 
        --table-name ProductCatalog 
        --key '{"Id": {"N": "456"}}' 
        --update-expression "SET Price = Price - :discount" 
        --condition-expression "Price > :limit" 
        --expression-attribute-values file://values.json
     
  • 相关阅读:
    PATA 1071 Speech Patterns.
    PATA 1027 Colors In Mars
    PATB 1038. 统计同成绩学生(20)
    1036. 跟奥巴马一起编程(15)
    PATA 1036. Boys vs Girls (25)
    PATA 1006. Sign In and Sign Out (25)
    读取web工程目录之外的图片并显示
    DOS命令
    java连接oracle集群
    servlet
  • 原文地址:https://www.cnblogs.com/cloudrivers/p/11628401.html
Copyright © 2011-2022 走看看