Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@shelf/dynamodb-query-optimized
Advanced tools
2x faster DynamoDB queries when you need to query 2+ MB of data
2x faster DynamoDB queries when you need to query 2+ MB of data
Read the blog post article explaining how it works: https://vladholubiev.medium.com/how-to-speed-up-long-dynamodb-queries-by-2x-c66a2987d53a
$ yarn add @shelf/dynamodb-query-optimized
Regular query: <1 MB of items: 650ms
Optimized query: <1 MB of items: 704ms
Regular query: ~21 MB of items: 9.023s
Optimized query: ~21 MB of items: 4.988s # almost 2x faster
For now, it supports aws-sdk
v2. Feel free to submit a PR to support aws-sdk
v3!
Queries DDB from both ends of the query in parallel. Stops and returns results when the middle is reached.
import {queryOptimized} from '@shelf/dynamodb-query-optimized';
import DynamoDB from 'aws-sdk/clients/dynamodb';
const ddb = new DynamoDB.DocumentClient({region: 'us-east-1'});
const results = await queryOptimized({
queryFunction: ddb.query.bind(ddb),
queryParams: {
TableName: 'example_table',
ProjectionExpression: 'hash_key, range_key',
KeyConditionExpression: '#hash_key = :hash_key AND begins_with(#range_key, :range_key)',
ExpressionAttributeNames: {
'#hash_key': 'hash_key',
'#range_key': 'range_key',
},
ExpressionAttributeValues: {
':hash_key': hash_key,
':range_key': range_key,
},
},
});
console.log(results);
/*
[{hash_key: 'foo', range_key: 'bar'}, {hash_key: 'foo', range_key: 'baz'}]
*/
Queries DDB and continues to paginate through all results until query is exhausted.
import {queryRegular} from '@shelf/dynamodb-query-optimized';
import DynamoDB from 'aws-sdk/clients/dynamodb';
const ddb = new DynamoDB.DocumentClient({region: 'us-east-1'});
const results = await queryRegular({
queryFunction: ddb.query.bind(ddb),
queryParams: {
TableName: 'example_table',
ProjectionExpression: 'hash_key, range_key',
KeyConditionExpression: '#hash_key = :hash_key AND begins_with(#range_key, :range_key)',
ExpressionAttributeNames: {
'#hash_key': 'hash_key',
'#range_key': 'range_key',
},
ExpressionAttributeValues: {
':hash_key': hash_key,
':range_key': range_key,
},
},
});
console.log(results);
/*
[{hash_key: 'foo', range_key: 'bar'}, {hash_key: 'foo', range_key: 'baz'}]
*/
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
MIT © Shelf
FAQs
2x faster DynamoDB queries when you need to query 2+ MB of data
The npm package @shelf/dynamodb-query-optimized receives a total of 4,694 weekly downloads. As such, @shelf/dynamodb-query-optimized popularity was classified as popular.
We found that @shelf/dynamodb-query-optimized demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 63 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.