stevearc / flywheel

Object mapper for Amazon's DynamoDB
MIT License
128 stars 25 forks source link

Bugx .one() raises "Expected one result!" but all() returns just one entry #57

Closed schabert closed 7 years ago

schabert commented 7 years ago

Hello, i have observed that our code raises a "Except one result!" exception.

engine.query(instance).filter(fqdn='some', deleted_at=None).one()

The problem is that when i call this code

engine.query(instance).filter(fqdn='some', deleted_at=None).all()

It returns an array with just one result (as excepted).

Some observations: The limit(2) condition prevent to get results. This request is on a global secondary index. There are more than one fqdn with 'some' but only one that where delete_at is set to None

stevearc commented 7 years ago

Oh no...I think that this is a problem with "scanned items" limit vs "returned items" limit. I wrote a bunch of code in dynamo3 to handle those cases but I may not have updated flywheel to do the correct thing. I'll dig into it and if that's what's going on I'll get a fix in this weekend

stevearc commented 7 years ago

Should be fixed and released in version 0.5.2