Comments (10)
I see the problem, I'll try to reproduce
from dynamodb-oop.
Hi Luiz,
Looks like a bug!
Can you add the following line and paste the output of it
dynamodb.on('beforeRequest', console.log )
Thanks
from dynamodb-oop.
I will make this and past the log here
from dynamodb-oop.
Allright, i'll check it and get back to you
from dynamodb-oop.
scan { TableName: 'table',
Select: undefined,
ProjectionExpression: undefined,
ExpressionAttributeNames: { '#domain': 'domain', '#create_at': 'create_at' },
FilterExpression: '( attribute_not_exists(#domain) ) AND \n( #create_at BETWEEN :create_at_1_v1 AND :create_at_2_v1 )',
ExpressionAttributeValues:
{ ':create_at_1_v1': { N: '1479772800000' },
':create_at_2_v1': { N: '1479945540000' } },
ReturnConsumedCapacity: 'TOTAL',
ExclusiveStartKey: undefined }
scan { TableName: 'table',
Select: undefined,
ProjectionExpression: undefined,
ExpressionAttributeNames: { '#domain': 'domain', '#create_at': 'create_at' },
FilterExpression: '( attribute_not_exists(#domain) ) AND \n( #create_at BETWEEN :create_at_1_v2 AND :create_at_2_v2 )',
ExpressionAttributeValues:
{ ':create_at_1_v1': { N: '1479772800000' },
':create_at_2_v1': { N: '1479945540000' },
':create_at_1_v2': { N: '1479772800000' },
':create_at_2_v2': { N: '1479945540000' } },
ReturnConsumedCapacity: 'TOTAL',
ExclusiveStartKey: { id: { S: '2cb44130-99e5-11a6-21b5-0203581001e5' } } }
from dynamodb-oop.
Seems to me that the error is produced by the nested call
I was not able to reproduce the same
I'm using:
DynamoDB.on('beforeRequest', console.log )
DynamoDB
.table($tableName)
.having('domain').null()
.having('create_at').between(1,3)
.scan( function(err, data) {
DynamoDB
.table($tableName)
.having('domain').null()
.having('create_at').between(1,3)
.resume({id: {'S': "test"}})
.scan( function(err, data) {
})
})
and my local output is
scan { TableName: 'test_hash_range',
Select: undefined,
ProjectionExpression: undefined,
ExpressionAttributeNames: { '#domain': 'domain', '#create_at': 'create_at' },
FilterExpression: '( attribute_not_exists(#domain) ) AND \n( #create_at BETWEEN :create_at_1_v1 AND :create_at_2_v1 )',
ExpressionAttributeValues: { ':create_at_1_v1': { N: '1' }, ':create_at_2_v1': { N: '3' } },
ReturnConsumedCapacity: 'TOTAL' }
scan { TableName: 'test_hash_range',
Select: undefined,
ProjectionExpression: undefined,
ExpressionAttributeNames: { '#domain': 'domain', '#create_at': 'create_at' },
FilterExpression: '( attribute_not_exists(#domain) ) AND \n( #create_at BETWEEN :create_at_1_v1 AND :create_at_2_v1 )',
ExpressionAttributeValues: { ':create_at_1_v1': { N: '1' }, ':create_at_2_v1': { N: '3' } },
ReturnConsumedCapacity: 'TOTAL',
ExclusiveStartKey: { id: { S: 'test' } } }
ExpressionAttributeValues seems fine.
are you using this.scan() for the second call ?
from dynamodb-oop.
No completly! I create a recursive function and only call again passing LastEvaluatedKey.
Clinic.findAllClinicsWithoutSitesBetween = function (init, end) {
const initDate = new Date(init);
const endDate = new Date(end);
const preparatedQuery = repository
.getTableConnection()
.having('domain').null()
.having('create_at').between(+initDate, +endDate);
return Clinic._findAllClinicsWithoutSites(preparatedQuery);
}
Clinic._findAllClinicsWithoutSites = function (preparatedQuery, $lastKey, finalData = []) {
let def = new Defer();
preparatedQuery
.resume($lastKey)
.scan(function(err, data) {
if (err) return def.reject(err);
finalData.push(...data);
if (this.LastEvaluatedKey === null) {
return def.resolve(finalData);
}
setTimeout(() => {
Clinic
._findAllClinicsWithoutSites(preparatedQuery, this.LastEvaluatedKey, finalData)
.then(def.resolve)
.catch(def.reject);
}, 500);
});
return def.promise;
}
from dynamodb-oop.
Oh, I see
I finally was able to get something similar with:
var dynamodb = DynamoDB.table($tableName)
dynamodb
.having('domain').null()
.having('create_at').between(1,3)
.scan( function(err, data) {
dynamodb
.having('domain').null()
.having('create_at').between(1,3)
.resume({id: {'S': "test"}})
.scan( function(err, data) {
})
})
Unfortunately you can not re-use the query with the current version of this library.
You will have to do the DynamoDB.table() every time
I'm adding a self note to reset the internal vars after each query and
probably the next version will work the way you;re trying to use it.
from dynamodb-oop.
😱 hehe no problem I will wait for this update. In the moment I will continue using the native sdk for this specific part.
Thanks man!
from dynamodb-oop.
released version 0.1.60,
with minimum changes this fixed my local replication of your described issue.
I still can not recommend using
var $users = DynamoDB.table('users')
$users.insert(...)
$users.update(...)
...
there are no tests to confirm that is ready for this change.
I'm closing the issue for now, please re-open it if you still see the issue.
Thanks
</adrian>
from dynamodb-oop.
Related Issues (20)
- update or insert is modifying my data object HOT 4
- Raising an issue to tell ... HOT 1
- Support for updating nested json in dynamoDB HOT 1
- Promise support HOT 4
- Boolean "false", becomes "undefined" HOT 6
- Docs scroll to top HOT 2
- Cannot use region provided in config.json HOT 2
- Executing an average operation on the DB HOT 1
- "OR" support in scan HOT 3
- Looping Scan with async/await question. HOT 3
- Issues due to shrinkwrap.json HOT 3
- Recursive scan example HOT 6
- Update table HOT 2
- Support to pass array of attribute names for "select" operand HOT 2
- Support Dynamo Transactions HOT 6
- BatchInsert not working HOT 2
- transact.insert is undefined on Lambda Layer HOT 2
- Support AWS SDK v3 HOT 2
- Disable Table Schema Table Warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynamodb-oop.