Hi Jeremy,

I've managed to get rid of the error. I installed the following gems - 
'sqlite3' (1.3.6), 'sqlite3-ruby' (1.3.3) and 'sequel' (3.39.0)

However, the grouping doesn't seem to work. My code -
db = Sequel.sqlite
db.create_table? :timesheets do
primary_key :id
String :project
Date :start
end

table = db[:timesheets]
table.insert(:project => 'AAA', :start  => DateTime.new(2008, 7, 8, 9, 00))
table.insert(:project => 'AAA', :start  => DateTime.new(2008, 7, 25, 10, 
00))
table.insert(:project => 'BBB', :start  => DateTime.new(2011, 5, 1, 9, 00))
table.insert(:project => 'BBB', :start  => DateTime.new(2011, 5, 10, 13, 
00))
table.insert(:project => 'BBB', :start  => DateTime.new(2011, 5, 20, 17, 
00))

puts table.group(:project).all.to_yaml
# --- 
# - :project: AAA
#   :start: 2008-07-25 15:30:00 +05:30
#   :id: 2
# - :project: BBB
#   :start: 2011-05-20 22:30:00 +05:30
#   :id: 5

puts table.group(Sequel.extract(:year, :start)).all.to_yaml
# --- 
# - :project: BBB
#   :start: 2011-05-20 22:30:00 +05:30
#   :id: 5

It seems only to give me details of the last inserted record.
Why? What am I doing wrong?

 - Abhijit.

On Monday, 10 September 2012 23:00:23 UTC+5:30, abhijit wrote:
>
> Apologies. I have both sqlite 2.8.17 and sqlite 3.7.4-2 installed. Is 
> there any way I can force sequel to use the sqlite3 version? (I think that 
> is the issue)?
>
>  - Abhijit.
>
> On Monday, 10 September 2012 22:51:46 UTC+5:30, abhijit wrote:
>>
>> I get the following error - 
>>
>> undefined method `extract' for Sequel:Module (NoMethodError)
>>
>> I'm using sequel version 3.29.0 and sqlite version 2.8.17
>>
>> Is it supported in a higher version of sqlite?
>>
>> Thanks,
>>  - Abhijit.
>>
>> On Monday, 10 September 2012 20:36:52 UTC+5:30, Jeremy Evans wrote:
>>>
>>> On Monday, September 10, 2012 1:41:07 AM UTC-7, abhijit wrote:
>>>>
>>>> I have a table with a date column where date is stored in this format -
>>>> 2012-08-01 16:39:17.601455+0530
>>>>
>>>> How do I 'group' or 'group_and_count' on this column by 'month'?
>>>>
>>>
>>>    dataset.group(Sequel.extract(:month, :date_column))
>>>
>>> Jeremy
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/gFhU1vM-0YYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to