@awspilot/dynamodb

Issue Star Fork

.table( tbl_name )

.insert()

Insert Item ( no update )
Insert is handled as putItem with an extra condition to make sure item does not already exist.

Insert does not replace existing items. Use .insert_or_replace() or .insert_or_update() instead.

WARNING: insert() will do an extra call (describeTable) to get the table schema and prevent item overwrite,
If an item with the same key exists, 'ConditionalCheckFailedException' error is returned

.insert_or_update()

Insert on Duplicate Item Update
Handled as updateItem.

.insert_or_replace()

Insert on Duplicate Item Replace

Handled as putItem.

.update()

Update Existing Item

Update is handled as updateItem with an extra condition to make sure item exists.

Update does not insert a new item if it does not already exist. Use .insert_or_update() instead.

Update can only update one item specified in WHERE (AWS DynamoDB limitation).

WARNING: update() will do an extra call (describeTable) to get the table schema and prevent item creation,
If an item with the same key does not exist, 'ConditionalCheckFailedException' error is returned

.replace()

Replace Item

.replace() does not create the item if item does not exist, use insert_or_replace() instead

.delete()

Delete Item

Delete is handled as deleteItem.

Does not fail if the item does not exist.

Deletes a single item in a table by primary key.

.get()

Get Item

.query()

The Query operation finds items based on primary key values.

.scan()

The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index.

.query( sql_statement )