medium / dynamite Goto Github PK
View Code? Open in Web Editor NEWA promise-based DynamoDB client
License: Other
A promise-based DynamoDB client
License: Other
I'm fairly new to DynamoDB and looking to migrate from our native aws library usage to this library.
I'm seeing an issue where our data types with attribute values M
or L
are throwing an unsupported error and it doesn't seem like they are supported but they exist in the official docs as valid types.
Am I missing something?
Thanks
P.S. It seems it would be fairly simple to support, something like:
case 'M':
var mapped = {};
for (var k in obj.M) {
mapped[k] = objectToValue(obj.M[k]);
}
return mapped;
case 'L':
return obj.L.map(objectToValue);
Currently dynamite returns ALL_NEW, it would be good to set this option on the query builder to return what is needed from the query.
Valid Values: NONE | ALL_OLD | UPDATED_OLD | ALL_NEW | UPDATED_NEW
I have a table that has a hashKey (userId), but no range key. I want to retrieve the user by userId, but I'm getting an error that Range Key is required.
I now it wasn't released yet (2.0.0-rc6) but it's close. I am just curious when do you plan that. Thank you.
Hi there, my code looks like:
client.newScanBuilder(tableName)
.filterAttributeEquals('status', 'FOO')
.execute()
.then((users) => {
});
but I get the exception:
TypeError: client.newScanBuilder(...).filterAttributeEquals is not a function
Is the readme up to date?
Thanks
In Dynamo, the limit
parameter of queries and scans limits the number of rows that are examined before filtering. In FakeDynamo the limit is applied only after filtering, so it can return many more results than Dynamo would.
Hi, my team is about to use your Client for DynamoDB, but we need all required functionality, exactly manipulating objects. AWS support using nested objects without converting them to string. As I can see, you have PR, dealing with it, but we'd like to use stable version, produced by you. Fix this small issue, we would appreciate that. Thanks for you attention!
I have a table with some attributes set to null.
Internally DynamoDB stores them as an object with an null attribute set to true:
my_attribute {
"NULL": true
}
When scanning the table Dynamite gives me that error apparently because NULL is not considered in objectToValue method.
Thanks for this handy lib. I'm new to DynamoDB, I would like to simply get the last 10 (for example) items inserted into a given table. How do I go about building the query?
Hi !
I try to use Dynamite but i'm lost.
How I can check that a username is not taken by another user? I tried with expectAttributeAbsent but it does not work. An idea ?
Thank you :)
`app.post('/signup', function (req, res) {
var user = req.body.user;
user.userId = uuidV4();
user.provider = 'local';
var conditions = client.newConditionBuilder()
.expectAttributeAbsent('username',user.username) // if the username doesn't exist in the database
client.putItem('user-table', user)
.withCondition(conditions)
.execute()
.then(function(data){
console.log(data)
res.json('work')
})
.fail(function(e) {
console.log(e);
res.status(500).json({ error: e });
})
})`
cc @nicks
Can be Kew replaced with a new goog.labs.Promise? Since I am using Closure code in Node.js, this would be fine improvement. Can I help somehow?
Any specific reason why the Map data type is not supported by this library?
I have just started using the library and would love support for this feature. Maybe someone could explain the complexity involved in adding support.
when i import this library to my lambda in serverless project, this error shows up
module initialization error: TypeError
at Object.<anonymous> (/var/task/discounts/router.js:648:79)
at __webpack_require__ (/var/task/discounts/router.js:20:30)
at Object.defineProperty.value (/var/task/discounts/router.js:597:15)
at __webpack_require__ (/var/task/discounts/router.js:20:30)
at Object.<anonymous> (/var/task/discounts/router.js:255:23)
at __webpack_require__ (/var/task/discounts/router.js:20:30)
at Object.defineProperty.value (/var/task/discounts/router.js:63:18)
at Object.<anonymous> (/var/task/discounts/router.js:66:10)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
Is this library compatible with generators or ES6's async/await syntax? If would it be possible to define our own promise library at runtime?
When I try to create new item which is containing boolean value, it gives me boolean validation error and I don't know what I'm doing wrong. Are there any other proper way to do it?
var data = {....};
data['id'] = uuid.v4();
data['verified'] = true;
client.putItem('UsersTable', data)
.execute()
.then(function(r) {
})
.fail(function(reason) {
console.log(reason);
});
The error is
{ [InvalidParameterType: Expected params.Item['verified'].BOOL to be a boolean] message: 'Expected params.Item['verified'].BOOL to be a boolean', code: 'InvalidParameterType', time: Mon Nov 09 2015 06:13:21 GMT+0000 (UTC) }
If I build a query with an index name but without any filter conditons, e.g.
new QueryBuilder()
.setTableName('Users')
.setHashKey('userId', ...)
.setIndexName('isAdmin-index')
.execute()
FakeDynamo doesn't know which attribute that corresponds to
FakeTable.prototype.query = function(data) {
var indexedKeyName
if (data.IndexName) {
// Global Secondary Index if the index name has three or more
// parts (separated by '-')
var indexParts = data.IndexName.split('-')
var probableGSIIndex = indexParts.length >= 3
if (probableGSIIndex) {
return this._queryGlobalSecondaryIndex(data)
}
// Extract the range key for Local Secondary Indexes
for (var key in data.KeyConditions) {
if (key !== this.primaryKey.hash.name) {
indexedKeyName = key
}
}
}
...
and (silently) fails to find anything as a result.
Can dynamite query by global secondary indexes?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.