PartiQL Insert Statements for DynamoDB - Amazon DynamoDB

PartiQL Insert Statements for DynamoDB

Use the INSERT statement to add an item to a table in Amazon DynamoDB.

Note

You can only insert one item at a time; you cannot issue a single DynamoDB PartiQL statement that inserts multiple items. For information on inserting multiple items, see Performing Transactions with PartiQL for DynamoDB or Running Batch Operations with PartiQL for DynamoDB.

Syntax

Insert a single item.

INSERT INTO table VALUE item

Parameters

table

(Required) The table where you want to insert the data. The table must already exist.

item

(Required) A valid DynamoDB item represented as a PartiQL tuple. You must specify only one item and each attribute name in the item is case-sensitive and can be denoted with single quotation marks ('...') in PartiQL.

String values are also denoted with single quotation marks ('...') in PartiQL.

Return value

This statement does not return any values.

Note

If the DynamoDB table already has an item with the same primary key as the primary key of the item being inserted, DuplicateItemException is returned.

Examples

INSERT INTO Music value {'Artist' : 'Acme Band','SongTitle' : 'PartiQL Rocks'}