Veraticus / Dynamoid

Ruby ORM for Amazon's DynamoDB
http://joshsymonds.com/Dynamoid/
247 stars 83 forks source link

No support for BETWEEN queries on range keys #166

Open m5rk opened 10 years ago

m5rk commented 10 years ago

DynamoDB supports BETWEEN queries for range keys as noted here:

http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/DynamoDB/Client/V20120810.html#query-instance_method

Does this mean that support for this in dynamoid won't be available until the adapter is updated to work with the newer DynamoDB client and/or the V2 APIs?

m5rk commented 10 years ago

We were able to get a range query to work for a datetime field by using a fake operator:

started_at = 2.days.ago
ended_at = 1.day.ago

some_date_range = started_at.to_f..ended_at.to_f

SomeModel.where(hash_key: key).where('started_at.between' => some_date_range)

The problem happens here:

https://github.com/Veraticus/Dynamoid/blob/752327c5926239f5fe612a22cde6f160f654769f/lib/dynamoid/indexes/index.rb#L72

m5rk commented 10 years ago

This may be a duplicate of #148