Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/lib-dynamodb

Package Overview
Dependencies
Maintainers
5
Versions
384
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/lib-dynamodb

The document client simplifies working with items in Amazon DynamoDB by abstracting away the notion of attribute values.

  • 3.699.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
increased by9.51%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/lib-dynamodb?

The @aws-sdk/lib-dynamodb package is a library that provides a simpler interface for interacting with Amazon DynamoDB from JavaScript applications. It is part of the AWS SDK for JavaScript (v3) and offers an abstraction over the lower-level DynamoDB client, making it easier to work with DynamoDB using JavaScript objects and syntax.

What are @aws-sdk/lib-dynamodb's main functionalities?

Performing CRUD Operations

This feature allows you to create, read, update, and delete items in a DynamoDB table. The code sample demonstrates how to insert an item into a DynamoDB table using the PutCommand.

{"PutCommand": "const { DynamoDBDocumentClient, PutCommand } = require('@aws-sdk/lib-dynamodb'); const client = DynamoDBDocumentClient.from(new DynamoDBClient({})); const putCommand = new PutCommand({ TableName: 'MyTable', Item: { id: '1', content: 'example' } }); client.send(putCommand);"}

Querying and Scanning Tables

This feature allows you to query items using a key condition expression or scan the entire table. The code sample shows how to query items from a DynamoDB table where the 'id' attribute matches a specific value.

{"QueryCommand": "const { DynamoDBDocumentClient, QueryCommand } = require('@aws-sdk/lib-dynamodb'); const client = DynamoDBDocumentClient.from(new DynamoDBClient({})); const queryCommand = new QueryCommand({ TableName: 'MyTable', KeyConditionExpression: 'id = :id', ExpressionAttributeValues: { ':id': '1' } }); client.send(queryCommand);"}

Batch Operations

This feature allows you to perform batch operations, such as batch writes (put and delete), on multiple items across one or more tables. The code sample demonstrates how to perform a batch write operation to put and delete items in a DynamoDB table.

{"BatchWriteCommand": "const { DynamoDBDocumentClient, BatchWriteCommand } = require('@aws-sdk/lib-dynamodb'); const client = DynamoDBDocumentClient.from(new DynamoDBClient({})); const batchWriteCommand = new BatchWriteCommand({ RequestItems: { 'MyTable': [ { PutRequest: { Item: { id: '2', content: 'example2' } } }, { DeleteRequest: { Key: { id: '3' } } } ] } }); client.send(batchWriteCommand);"}

Transaction Support

This feature allows you to perform multiple put, update, and delete operations across multiple tables atomically. The code sample shows how to use the TransactWriteItemsCommand to perform atomic transactions in DynamoDB.

{"TransactWriteItemsCommand": "const { DynamoDBDocumentClient, TransactWriteItemsCommand } = require('@aws-sdk/lib-dynamodb'); const client = DynamoDBDocumentClient.from(new DynamoDBClient({})); const transactWriteItemsCommand = new TransactWriteItemsCommand({ TransactItems: [ { Put: { TableName: 'MyTable', Item: { id: '4', content: 'example4' } } }, { Delete: { TableName: 'MyTable', Key: { id: '5' } } } ] }); client.send(transactWriteItemsCommand);"}

Other packages similar to @aws-sdk/lib-dynamodb

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc