Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for BETWEEN queries on range keys #166

Open
m5rk opened this issue Dec 11, 2013 · 2 comments
Open

No support for BETWEEN queries on range keys #166

m5rk opened this issue Dec 11, 2013 · 2 comments

Comments

@m5rk
Copy link

m5rk commented Dec 11, 2013

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
Copy link
Author

m5rk commented Dec 12, 2013

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:

hash[:range_value] = range_keys.inject(0.0) {|sum, key| sum + attrs[key].to_f} if self.range_key?

@m5rk
Copy link
Author

m5rk commented Dec 12, 2013

This may be a duplicate of #148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant