@lifeomic/dynamodb-dataloader
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

dynamodb-dataloader

npm Build Status Greenkeeper badge

A DataLoader that batches requests for DynamoDB. The DataLoader can fetch items from multiple tables at once so you should only need one instance per request.

You should be able to replace your calls to dynamoClient.get with loader.load and automaticly switch your network calls from GetItem to BatchGetItem.

NOTE: Make sure you update your IAM policy to allow dynamodb:BatchGetItem if you have strict IAM policies

Example code

const { createDataLoader } = require('@lifeomic/dynamodb-dataloader');

// Once per request or scope that can share data access
const client = new AWS.DyanmoDB();
const loader = createDataLoader({ client });

// Once per item fetch
const item = await loader.load({
  table: 'your table name',
  key: { idAattribute: { S: 'some id' } }
});

Dependencies (2)

Dev Dependencies (10)

Package Sidebar

Install

npm i @lifeomic/dynamodb-dataloader

Weekly Downloads

303

Version

1.0.2

License

MIT

Unpacked Size

165 kB

Total Files

7

Last publish

Collaborators

  • lifeomicdev
  • npm-lifeomicdev-github