404

[ Avaa Bypassed ]




Upload:

Command:

botdev@13.58.146.48: ~ $
**Example 1: To update an item in a table**

The following ``update-item`` example updates an item in the ``MusicCollection`` table. It adds a new attribute (``Year``) and modifies the ``AlbumTitle`` attribute. All of the attributes in the item, as they appear after the update, are returned in the response. ::

    aws dynamodb update-item \
        --table-name MusicCollection \
        --key file://key.json \
        --update-expression "SET #Y = :y, #AT = :t" \
        --expression-attribute-names file://expression-attribute-names.json \
        --expression-attribute-values file://expression-attribute-values.json  \
        --return-values ALL_NEW \
        --return-consumed-capacity TOTAL \
        --return-item-collection-metrics SIZE

Contents of ``key.json``::

    {
        "Artist": {"S": "Acme Band"},
        "SongTitle": {"S": "Happy Day"}
    }

Contents of ``expression-attribute-names.json``::

    {
        "#Y":"Year", "#AT":"AlbumTitle"
    }

Contents of ``expression-attribute-values.json``::

    {
        ":y":{"N": "2015"},
        ":t":{"S": "Louder Than Ever"}
    }

Output::

    {
        "Attributes": {
            "AlbumTitle": {
                "S": "Louder Than Ever"
            },
            "Awards": {
                "N": "10"
            },
            "Artist": {
                "S": "Acme Band"
            },
            "Year": {
                "N": "2015"
            },
            "SongTitle": {
                "S": "Happy Day"
            }
        },
        "ConsumedCapacity": {
            "TableName": "MusicCollection",
            "CapacityUnits": 3.0
        },
        "ItemCollectionMetrics": {
            "ItemCollectionKey": {
                "Artist": {
                    "S": "Acme Band"
                }
            },
            "SizeEstimateRangeGB": [
                0.0,
                1.0
            ]
        }
    }

For more information, see `Writing an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.WritingData>`__ in the *Amazon DynamoDB Developer Guide*.

**Example 2: To update an item conditionally**

The following example updates an item in the ``MusicCollection`` table, but only if the existing item does not already have a ``Year`` attribute. ::

    aws dynamodb update-item \
        --table-name MusicCollection \
        --key file://key.json \
        --update-expression "SET #Y = :y, #AT = :t" \
        --expression-attribute-names file://expression-attribute-names.json \
        --expression-attribute-values file://expression-attribute-values.json  \
        --condition-expression "attribute_not_exists(#Y)"

Contents of ``key.json``::

    {
        "Artist": {"S": "Acme Band"},
        "SongTitle": {"S": "Happy Day"}
    }

Contents of ``expression-attribute-names.json``::

    {
        "#Y":"Year",
        "#AT":"AlbumTitle"
    }

Contents of ``expression-attribute-values.json``::

    {
        ":y":{"N": "2015"},
        ":t":{"S": "Louder Than Ever"}
    }

If the item already has a ``Year`` attribute, DynamoDB returns the following output. ::

    An error occurred (ConditionalCheckFailedException) when calling the UpdateItem operation: The conditional request failed

For more information, see `Writing an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.WritingData>`__ in the *Amazon DynamoDB Developer Guide*.

Filemanager

Name Type Size Permission Actions
wait Folder 0755
batch-get-item.rst File 1.95 KB 0644
batch-write-item.rst File 2.92 KB 0644
create-backup.rst File 860 B 0755
create-global-table.rst File 1.03 KB 0755
create-table.rst File 22.02 KB 0644
delete-backup.rst File 1.85 KB 0755
delete-item.rst File 2.8 KB 0644
delete-table.rst File 789 B 0644
describe-backup.rst File 1.89 KB 0755
describe-continuous-backups.rst File 745 B 0755
describe-contributor-insights.rst File 1.14 KB 0644
describe-endpoints.rst File 542 B 0755
describe-global-table-settings.rst File 1.55 KB 0755
describe-global-table.rst File 952 B 0755
describe-limits.rst File 576 B 0755
describe-table-replica-auto-scaling.rst File 4.11 KB 0755
describe-table.rst File 1.41 KB 0644
describe-time-to-live.rst File 551 B 0755
get-item.rst File 3.17 KB 0644
list-backups.rst File 7.38 KB 0644
list-contributor-insights.rst File 3.33 KB 0644
list-global-tables.rst File 739 B 0755
list-tables.rst File 2.79 KB 0644
list-tags-of-resource.rst File 2.34 KB 0644
put-item.rst File 2.68 KB 0644
query.rst File 6.88 KB 0644
restore-table-from-backup.rst File 2.17 KB 0755
restore-table-to-point-in-time.rst File 2.05 KB 0755
scan.rst File 1.48 KB 0644
tag-resource.rst File 510 B 0755
transact-get-items.rst File 2.02 KB 0644
transact-write-items.rst File 3.98 KB 0644
untag-resource.rst File 521 B 0755
update-continuous-backups.rst File 908 B 0755
update-contributor-insights.rst File 780 B 0644
update-global-table-settings.rst File 2.15 KB 0755
update-global-table.rst File 1.06 KB 0755
update-item.rst File 3.39 KB 0644
update-table-replica-auto-scaling.rst File 6.29 KB 0755
update-table.rst File 14.27 KB 0644
update-time-to-live.rst File 585 B 0755