jed / dynamo Goto Github PK
View Code? Open in Web Editor NEWDynamoDB client for node.js
License: MIT License
DynamoDB client for node.js
License: MIT License
Scan example on https://github.com/jed/dynamo/wiki/High-level-API is:
table.scan({
name: "dynamo",
iq: {">=": 100}
})
.get(["name", "iq", "status"])
.count()
.fetch(function(err, count){ ... })
But documentation for scan.count()
just below this says: "cannot be used if Scan#get()
is called"
The current API pays relies key order in the schema parameter passed to new db.Table().
However, this can fail on an ECMA-262 5th Ed. complaint interpreter. Perhaps it should be changed to a list:
recipeTable = new db.Table({
name: "recipes",
schema: [ {userId: Number}, {date: String} ] // key order insensitive
throughput: {read: 10, write: 10}
})
Writing a character like 人
raises this error from dynamodb
com.amazon.coral.service#InvalidSignatureException: The request signature we calculated does not match the signature you provided.
`healthy: dynamodb.eu-west-1.amazonaws.com
^
SyntaxError: Unexpected token h
at Object.parse (native)
at IncomingMessage. (/Users/arpecop/Desktop/API/lambda/zanimaime/node_modules/dynamo/lib/Request.js:37:36)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at doNTCallback2 (node.js:450:9)
at process._tickCallback (node.js:364:17)`
It appears that item.save(callback) is not implemented as spec'ed out in the API.
Hello
I was trying to use dynamo module for a little class project but its not working and giving a unusual error "healthy: dynamodb.us-east-1.amazonaws.com
^
SyntaxError: Unexpected token h "
I am all torn out seeking out the reason for this error.
Please let me know what could be the possible error.
here is the code that i have been trying to use
var dynamo = require("dynamo")
, client = dynamo.createClient()
, db = client.get("us-east-1")
db.createTable({
TableName: "DYNAMO_TEST_TABLE_1",
ProvisionedThroughput: {
ReadCapacityUnits: 5,
WriteCapacityUnits: 5
},
KeySchema: {
HashKeyElement: {
AttributeName: "hash",
AttributeType: "S"
}
}
}, function(err, data){ ... }
Thanks and regards
Hi Jed,
Can you please publish the latest to npm with the fix from this commit?
I just spent quite a while tracking down this bug, only to realize it was already fixed on github.
Thanks a bunch.
I tried to use the method item.when(predicates)
.
In every version passed the predicate object i could not generate a valid conditional request like:
Expected: { id: { Exists: false } }
So i check your code and found out you forcing the value of the predicate to an array. Predicate.js:39
So it's only possible to get the operator
= NE
or EQ
, witch where necessary to the item.when()
, if you pass something like this:
new Predicate( { id: { "!=": [ undefined ] } } ) // a like bit weird ;-)
Now the problem
Within the Update.js:28 you check for null
in combination with NE
or EQ
. I think that this can never be reached with the current predicate implementation.
A small rewrite to make it possible to generate a valid conditional request Update.js:28
:
if (value === null || value === undefined) {
But this is not really a nice solution.
Can you check the method item.when()
for conditional requests or can you tell me how to use them.
I know that DynamoDB has limit of 100 items GET.
And it returns continuing key to continue to fetch
next 100 results.
"Dynamo" says It aims to abstract DynamoDB's implementation (request signing, session tokens, pagination)
How can you do pagination by using Dynamo ? Can you provide me an example?
I get an error that the first argument to db.listTables(args,callback) should be a string. When I put the empty string, it seems to work, but this shouldn't be necessary. I am new to all this so another explanation is that I'm not making any sense....
Also, fleshing out the low-level api with some examples would be very helpful. I'm not exactly sure what the arguments should be like for many of the functions.
I installed everything last week and it worked like a charm, today I run the npm install dynamo in a new laptop and the same code is no longer running.
If I run
var dynamo = require("dynamo"),
client = dynamo.createClient({
accessKeyId: "xxxxx",
secretAccessKey: "xxxxxx"
}),
db = client.get("ap-northeast-1");
client.get is raising this error
../dynamo/node_modules/dynamo-client/index.js:247
throw new Error("No secret access key available.")
^
Error: No secret access key available.
So I was playing around with the different options and I found out that if I write
var dynamo = require("dynamo"),
client = dynamo.createClient("ap-northeast-1",
{
accessKeyId: "xxxxx",
secretAccessKey: "xxxxxx"
})
It works. This is the way dynamo-client is creating the object, so I'm not sure if the High level Api is still usable.
Also if I run
client = dynamo.createClient("ap-northeast-1",
{
accessKeyId: "xxxx",
secretAccessKey: "xxxx"
}),
db = client.get("ap-northeast-1");
It will complain with this error
db = client.get("ap-northeast-1");
^
TypeError: Object # has no method 'get'
So looks like some of the methods are no longer available
Am I doing something wrong?
Thanks for the hard work!
the capacity units consumed per operation are currently undersupported. would be nice to make these more visible in the high-level API.
this API was added last week, and only exists in the low-level API for now.
in the first code section 'table.name' should actually be 'table.TableName'
For the use case of using dynamo
via command line program running in a shell, it would be nice to be able to pass an optional saved session token when creating a client in order not to get rate limited by AWS Security Token Service.
db = dynamo.createClient({
accessKeyId: "...",
secretAccessKey: "...",
sessionToken: "..." // optional saved session token
});
I wasn't able to find how to delete items in the high-level api documentation. Perhaps I overlooked something?
while currently undocumented, this library takes a different approach to retries using the (err, data, next)
signature in callback functions. in this case, next is a function that has the currently specified query in a closure:
err
does not exist, next
is used for iteration/pagination to get the next set of results.err
does exist, next
is a retry function that can be executed at user discretionthe idea behind diverging from other SDKs is that retrying shouldn't be baked into the library, but performed according to user policy. would love to get feedback on this before settling on it in the documentation.
I know you say that this is deprecated for the aws-sdk. But the aws-sdk is missing all of your sweet high-level functions.
I want the blue pill :)
raw response from dynamoDB below fails when Attributes.prototype.parse(data)
{
ConsumedCapacityUnits: 0.5,
Item:
{
name: { S: 'Christian Lewis' },
id: { S: '28664d40-6195-11e1-8d85-0be46e39396b' },
screen_name: { S: 'Tyler Young' }
}
}
I'm suspecting it's to do with ConsumedCapacityUnits
Am I not supposed to do table.get(key).fetch(opts, cb)?
It's basically failing to parse the raw response from Dynamo with stacktrace below
TypeError: Object.keys called on non-object
at Function.keys (native)
at Object.parse (node_modules/dynamo/lib/Value.js:17:23)
at node_modules/dynamo/lib/Attributes.js:20:34
at Array.forEach (native)
at Object.parse (node_modules/dynamo/lib/Attributes.js:18:23)
at node_modules/dynamo/lib/Item.js:54:32
at node_modules/dynamo/lib/Database.js:67:44
at IncomingMessage. (node_modules/dynamo/lib/Request.js:38:43)
amazon has added several zones (US, tokyo, singapore, ireland, etc.) since launch, which need to be supported.
If you try to add 0 (zero) via an update command, you get the exception:
com.amazon.coral.validate#ValidationException: One or more parameter values were invalid: Only DELETE action is allowed when no attribute value is specified
I think the bug is in Update.js, line 60 when you check if "value" is true. Zero is false, so the value is never set.
Thanks for the great library!
(preferrably in the format "v1.2.3")
It makes tooling easier :)
currently, tables are specified by name only, and the schema is inferred at query time.
it would probably be better to avoid issues like #9 by making table schemas mandatory, so that queries that violate the schema fail before execution.
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.