I have a DataMapper based SQLite database. I store the time at which the data upon which the model is built as Msrun.rawtime or a property :rawtime, DateTime, of the Model Msrun.
What I need to be able to do is select a date/time range in a filter, and then sort the DataMapper entries according to that time filter. Like this:
Msrun.all.size # => 63
matches = Msrun.all( begintime: 2010-11-03T21:33:00-0600, endtime: 2011-04-09T23:59:59-0600 )
matches.size # => 12
As my database has ~500 properties between this and submodels, and I expect to generate ~100 of these entries per month, I would like something that is really fast too. Is that going to require SQL? Is this possible? Am I making this harder than it should be/is there an easier way to configure my data to enable this type of sort?
I’m not sure what is you want to do? If you want to query for items that happen between a particular start and end time, you can use:
This will generate SQL something like
Does that answer your question?
A fuller example: