# ANN: Sequel 0.3.2 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-0-3-2-released/118970>\
**Category:** Ruby\
**Created:** [November 1, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/ann-sequel-0-3-2-released/118970 "2007-11-01T20:35:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciconia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@ciconia](https://www.ruby-forum.com/u/ciconia)\
**Post date:** [November 1, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/ann-sequel-0-3-2-released/118970/1 "2007-11-01T20:35:08Z")

</div>

Sequel version 0.3.2 has just been released. This release includes new  
Dataset functionality, magic methods and a few other minor  
improvements and bug fixes.

Following is a discussion of the changes:

=== New Dataset functionality

A few new methods have been added to the Dataset class. The  
#group\_and\_count methods returns a dataset grouped by the given  
column, along with a count for each group:

posts.group\_and\_count(:category).sql  
#=\> “SELECT category, count(category) AS count FROM posts GROUP BY  
category ORDER BY count”

The #range method returns a Range object made from the minimum and  
maximum values for the given column:

posts.filter(:category =\> ‘ruby’).range(:view\_count)  
#=\> 11…35

The #interval method returns the interval between the minimum and  
maximum values for the given column:

posts.filter(:category =\> ‘ruby’).interval(:view\_count)  
#=\> 24

=== Dataset magic methods

The Dataset class now supports magic methods: order\_by\_xxx,  
first\_by\_xxx, last\_by\_xxx, filter\_by\_xxx, group\_by\_xxx and  
count\_by\_xxx. These methods can be used :

posts.order\_by\_stamp.sql  
#=\> “SELECT \* FROM posts ORDER BY stamp”

posts.first\_by\_stamp #=\> first row ordered by stamp  
posts.last\_by\_stamp #=\> last row ordered by stamp

posts.filter\_by\_category(‘ruby’).sql  
#=\> “SELECT \* FROM posts WHERE (category = ‘ruby’)”

posts.group\_by\_category.sql  
#=\> “SELECT \* FROM posts GROUP BY category”

posts.count\_by\_category.sql  
#=\> “SELECT category, count(category) AS count FROM posts GROUP BY  
category ORDER BY count”

=== Other improvements and bug fixes

- Model.create and Model.new can now accept a block:

- Added Dataset#set as alias to Dataset#update.

- Fixed Oracle::Database#execute (#84).

- Fixed timestamp translation in SQLite adapter (#83).

- Experimental DB2 adapter.

- Removed long deprecated expressions.rb code.

- More documentation.

- Revised code to refer to ‘columns’ instead of ‘fields’.

=== More info

Sequel project page:  
[http://code.google.com/p/ruby-sequel](http://code.google.com/p/ruby-sequel)

Sequel documentation:  
[http://sequel.rubyforge.org](http://sequel.rubyforge.org)

Join the Sequel-talk group:  
[http://groups.google.com/group/sequel-talk](http://groups.google.com/group/sequel-talk)

Install the gem:  
sudo gem install sequel

Or check out the source and install manually:  
svn co [http://ruby-sequel.googlecode.com/svn/trunk](http://ruby-sequel.googlecode.com/svn/trunk) sequel  
cd sequel  
rake install
