wantworthy / dynode Goto Github PK
View Code? Open in Web Editor NEWnode.js client for Amazons DynamoDB
License: Apache License 2.0
node.js client for Amazons DynamoDB
License: Apache License 2.0
I'm using this route as a way to nuke my database. The idea is to delete the table and when done, recreate it.
server.get('/fixture/nukedata', function (req, res) {
dynode.deleteTable('CardTable', function(a, b) {
console.log(a, b);
dynode.createTable("CardTable", console.log);
});
});
I get an error message saying: "Attempt to change a resouce which is still in use: Table is being deleted: CardTable"
Is this dynode returning too early or is it that Amazon's response doesn't is async?
add support for new DynamoDB batchWriteItem api call
http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_BatchWriteItems.html
add in an option to provide a table name prefix in order to support different environments such as dev, testing and production
This is the AmazonError message that comes back when inserting a simple unicode string using the putItem method.
"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."
Any ideas?
I got this email this morning.
Dear Amazon DynamoDB Customer,
We are happy to announce that Amazon DynamoDB now supports the AWS Signature V4 request signing protocol. With Signature V4, you can make requests to DynamoDB that are signed by your regular AWS User or Account credentials, meaning that your application no longer needs to obtain temporary credentials from the AWS Security Token Service prior to making requests to DynamoDB. This improves application startup time, and removes the need to do complex temporary credential caching logic in applications with short-lived process lifetimes, which is common in PHP applications.
This seems like it would help a lot with the number of requests that Dynode makes to DynamoDB. Are you working on integrating this by now, perchance? If not, we'll try to take a crack at it---any pointers to the appropriate code areas to modify would be appreciated.
nice library! -- just started using it. deleteTable appears to be in your code but not the doc.
currently if you call getItem with keys that don't match documents in DynamoDB you get back an empty object, this should be null instead.
Amazon recently added support for storing binary data. More info: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/DataModel.html#DataModelDataTypes
I noticed when you want to pass a nested JSON object with put item (also update item), it insert the object into the database as [object, object].
I haven't started looking into your code in to mush depth yet, but as aws can support nested json objects, it would worth looking into.
Example
Trying to insert the following object into a new table won't give any warnings
var object = {
"id": "id",
"num": 1,
"str": "string",
"Obj": {
"num": 1,
"str": "string"
}
};
dynode.putItem("NewTable", object);
However amazon will show it inserted as:
{
"id": "id",
"num": 1,
"Obj": "[object Object]",
"str": "string"
}
I need to store my dialogs id in dialogs column. But I don't know how to set Action: ADD for adding values to existing data in number set. By default set is PUT whitch override whole NS Need help.
My attempts
var userDialog = {
dialogs:[Number(dialog.id)]
};
dynode.updateItem('userDialogs', 1, userDialog, {"Action":"ADD"}, function (err, res) {
if (err) {
console.log(err);
return false;
}
console.log(res);
});
id Number ( Hash key)
dialogs Number Set
ps Sorry for english
I am not sure if this is an issue with just my setup or has something to do with something else. I've gotten the module installs, i can reference it accordingly.
However, when I call a function from the library I cant seem to get anything to print out or the callback to ever get called. It seems to never get to the 'self.request.send' callback in _request of client.js.
I also cant seem to get any kind of error printed or anything like that either. Any ideas?
I'm literally just doing:
client.listTables(callbackFunction);
I'm using dynode with my instances and works well when credentials are passed during configuration.
How should I make it work without passing access key and secret? AWS NodeJS SDK provides support for this where it looks for IAM role credentials when not provided. Do you suggest a cleaner approach?
Why is a simple
client.scan("Employee", console.log);
giving me the error:
/src/node_modules/dynode/lib/dynode/types.js:118
throw new Error("Unsupported type: "+ type);
^
Error: Unsupported type: BOOL
My dynamoDB JSON looks like that:
{ "isPresent": { "BOOL": false }, "name": { "S": "Some Name" } }
Hello
I'm trying to use the EU region but the table keeps getting created in the US-EAST region.
My code is this:
var dynode = require('dynode');
dynode.auth({
region: "eu-west-1",
accessKeyId: "xxxxxx",
secretAccessKey: "xxxxxx"
});
dynode.createTable("CardTable", console.log);
output:
null { TableDescription:
{ CreationDateTime: 1342962562.553,
KeySchema: { HashKeyElement: [Object] },
ProvisionedThroughput: { ReadCapacityUnits: 10, WriteCapacityUnits: 5 },
TableName: 'CardTable',
TableStatus: 'CREATING' } }
Then when I try to use:
dynode.putItem("CardTable", {id: "1",card: 1, suit: "H"}, console.log);
And I go to the AWS console, I see it's in the US table.
I've also tried: dynamodb.eu-west-1.amazonaws.com
Thanks
Sam
Starting from 2012-10-01 we get the following error:
error: dynode.batchGetItem returned error: AmazonError - BatchGetItem 400 IncompleteSignatureException: Date must be in ISO-8601 'basic format'. Got '202201T000748Z'. See http://en.wikipedia.org/wiki/ISO_8601
Please note that the date is 202201 instead of 20121001. This is a variable type isue - number vs string - in aws-signer.js lines 65-70 and line 90.
To resolve, change line 90 to:
return n < 10 ? '0'+n : String(n);
Getting the following error:
{ name: 'AmazonError',
type: 'ValidationException',
serviceName: 'com.amazon.coral.validate',
message: 'One or more parameter values were invalid: Mismatching attribute types between location and schema',
statusCode: 400,
retry: [Getter] }
Basically it came down to that the range selector I was using was being passed through as a string instead of a number. This is even though I am chaining queries, having just gotten the range selector out of another table and am immediately using it in the query that is failing. The way I was able to fix it was by casting it from a string into a number (the way Amazon expects it to come across):
results.Items.forEach(function(element, index, array){
console.log(element);
element.events.SS.forEach(function(ielement, iindex, iarray){
var batchVars = {"events": {keys:[ {hash: ielement, range: parseInt(element.timestamp.N)} ]}};
dynode.batchGetItem(batchVars, events.debugOutput);
}, query);
}, query);
Here's a gist with a lot more context:
https://gist.github.com/2502794
I know this code is probably all crap, I'm a complete newb to node.js & dynamoDB (not to mention dynode).
Thanks!
Hello there!
First of all, thanks for creating this module! I'm anxious to get started testing it out : )
However, when, I try to install with npm (following your instructions here on github), the dynode directory doesn't contain an index.js (or any js file).
[servername@ip-10-117-34-116 wsnode]$ cat /proc/version
Linux version 2.6.35.14-106.49.amzn1.x86_64 ([email protected]) (gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Fri Dec 2 18:19:57 UTC 2011
[servername@ip-10-117-34-116 wsnode]$ nvm ls
v0.6.4
current: v0.6.4
default -> v0.6.4
[servername@ip-10-117-34-116 wsnode]$ npm --unicode=false ls
[email protected] /home/servername/wsnode
+-- [email protected] extraneous
â +-- [email protected]
â +-- [email protected]
â +-- [email protected]
â â +-- [email protected]
â â +-- [email protected]
â â +-- [email protected]
â â `-- [email protected]
â `-- [email protected]
â `-- [email protected]
+-- [email protected]
â +-- [email protected]
â â `-- [email protected]
â +-- [email protected]
â +-- [email protected]
â `-- [email protected]
+-- [email protected] extraneous
+-- [email protected]
+-- [email protected] extraneous
â `-- [email protected]
â +-- [email protected]
â `-- [email protected]
`-- [email protected] extraneous
+-- [email protected]
+-- [email protected]
`-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
[servername@ip-10-117-34-116 wsnode]$ ll node_modules/dynode/
total 44
drwxr-xr-x 3 servername servername 4096 Feb 27 23:34 lib
-rw-r--r-- 1 servername servername 10212 Jan 27 05:35 LICENSE
-rw-r--r-- 1 servername servername 756 Feb 5 18:35 Makefile
drwxrwxr-x 6 servername servername 4096 Feb 27 23:34 node_modules
-rw-r--r-- 1 servername servername 742 Feb 7 21:39 package.json
-rw-r--r-- 1 servername servername 9999 Feb 5 18:25 README.md
drwxr-xr-x 4 servername servername 4096 Feb 27 23:34 test
Any thoughts on what I'm messing up?
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.