# ANN: Sequel 1.1 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-1-1-released/128154>\
**Category:** Ruby\
**Created:** [February 5, 2008, 1:06pm UTC](https://www.ruby-forum.com/t/ann-sequel-1-1-released/128154 "2008-02-05T13:06:41Z")\
**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:** [February 5, 2008, 1:06pm UTC](https://www.ruby-forum.com/t/ann-sequel-1-1-released/128154/1 "2008-02-05T13:06:41Z")

</div>

Sequel version 1.1 has just been released. Sequel is a lightweight  
database  
access and ORM library for Ruby. Sequel provides thread safety,  
connection  
pooling and a simple and expressive API for constructing database  
queries and  
table schemas.

The latest release of Sequel includes some major improvements to  
Sequel model  
classes, including implicit table names, support for virtual  
attributes and  
better validations, as well as many improvements and bug fixes to the  
Sequel  
core and the database adapters. Following is a discussion of the main  
changes:

=== DRY Sequel models

With the new Sequel release you no longer need to explicitly specify  
the table  
name for each model class, assuming your model name is the singular of  
the  
table name (just like in ActiveRecord or DataMapper):

class UglyBug \< Sequel::Model  
end

UglyBug.table\_name #=\> :ugly\_bugs

=== New model validations and support for virtual attributes

Sequel model now include validation functionality which largly follows  
the  
validations offered in ActiveRecord. Validations can be checked  
anytime by  
calling Model#valid?, with validation errors accessible through  
Model#errors:

class Item \< Sequel::Model  
validates\_presence\_of :name  
end

my\_item = Item.new  
my\_item.valid? #=\> false  
my\_item.errors.full\_messages #=\> [“name is not present”]

The Model#save method has been changed to check for validity before  
saving. If  
the model instance is not valid, the #save method returns false  
without saving  
the instance. You can also bypass the validity test by calling  
Model#save!  
instead.

Model classes also now support virtual attributes, letting you assign  
values to  
any attribute (virtual or persistent) at initialization time:

class User \< Sequel::Model  
attr\_accessor :password  
end

u = User.new(:password =\> ‘blah’, …)  
u.password #=\> ‘blah’

Also, virtual attributes can be validated just like persistent  
attributes.

=== Other changes (long list!)

- Added Model#reload as alias to Model#refresh.

- Changed Model.create to accept a block (#126).

- Fixed Model#initialize to accept nil values (#115).

- Added Model#update\_with\_params method with support for virtual  
attributes and auto-filtering of unrelated parameters, and changed  
Model.create\_with\_params to support virtual attributes (#128).

- Fixed Model.dataset to correctly set the dataset if using implicit  
naming or inheriting the superclass dataset (thanks celldee).

- Finalized support for virtual attributes.

- Fixed Model#set to work with string keys (#143).

- Fixed Model.create to correctly initialize instances marked as new  
(#135).

- Fixed Model#initialize to convert string keys into symbol keys. This  
also fixes problem with validating objects initialized with string  
keys (#136).

- Added Dataset#table\_exists? convenience method.

- Changed Dataset#group\_and\_count to accept multiple columns (#134).

- Added Dataset#select\_all method.

- Added Dataset#select\_more, Dataset#order\_more methods (#129).

- Fixed Dataset#count to work correctly for grouped datasets (#144).

- Fixed joining datasets using aliased tables (#140).

- Added support for UNSIGNED constraint, used in MySQL? (#127).

- Implemented constraint definitions inside Database#create\_table.

- Enhanced Database.connect to accept options with string keys, so it  
can now accept options loaded from YAML files. Database.connect also  
automatically converts :username option into :user for compatibility  
with existing YAML configuration files for AR and DataMapper.

- Changed ODBC::Database to support connection using driver and  
database name, also added support for untitled columns in  
ODBC::Dataset (thanks Leonid Borisenko).

- Changed MySQL adapter to support specifying socket option.

- Fixed MySQL adapter to correctly format foreign key definitions  
(#123).

- Changed MySQL::Dataset to allow HAVING clause on ungrouped datasets,  
and put HAVING clause before ORDER BY clause (#133).

- Changed mysql adapter to default to localhost if :host option is not  
specified (#114).

- Added String#to\_date. Updated mysql adapter to use String#to\_date  
for mysql date types (thanks drfreeze).

- Fixed postgres adapter to define PGconn#async\_exec as alias to #exec  
if not defined (for pure-ruby postgres driver).

- Changed postgres adapter to quote column references using double  
quotes.

- Applied patch for oracle adapter: fix behavior of limit and offset,  
transactions, #table\_exists?, #tables and additional specs (thanks  
Liming L. #122).

- Added support additional field types in postgresql adapter (#146).

- Added support for date field types in postgresql adapter (#145).

- Added support for limiting and paginating datasets with fixed SQL,  
e.g. using Database#fetch.

- Added new Dataset#from\_self method that returns a dataset selecting  
from the original dataset.

- Allow for additional filters on a grouped dataset (#119 and #120)

- Refactored Sequelizer to use Proc#to\_sexp (method provided by r2r).

- Fixed bin/sequel to require sequel\_model if available.

=== More info on Sequel

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)

Join Sequel discussion on IRC at #sequel.

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
