# ANN: Sequel 2.7.0 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-2-7-0-released/152452>\
**Category:** Ruby\
**Created:** [November 4, 2008, 3:31am UTC](https://www.ruby-forum.com/t/ann-sequel-2-7-0-released/152452 "2008-11-04T03:31:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nerdmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c68b51/32.png) [@nerdmaster](https://www.ruby-forum.com/u/nerdmaster)\
**Post date:** [November 4, 2008, 3:31am UTC](https://www.ruby-forum.com/t/ann-sequel-2-7-0-released/152452/1 "2008-11-04T03:31:21Z")

</div>

- Sequel provides thread safety, connection pooling and a concise DSL  
for constructing database queries and table schemas.
- Sequel also includes a lightweight but comprehensive ORM layer for  
mapping records to Ruby objects and handling associated records.
- Sequel supports advanced database features such as prepared  
statements, bound variables, master/slave configurations, and  
database sharding.
- Sequel makes it easy to deal with multiple records without having  
to break your teeth on SQL.
- Sequel currently has adapters for ADO, DB2, DBI, Informix, JDBC,  
MySQL, ODBC, OpenBase, Oracle, PostgreSQL and SQLite3.

Sequel 2.7.0 has been released and should be available on the gem  
mirrors. The 2.7.0 release adds numerous improvements:

## Performance Optimizations

- Fetching a large number of records with the PostgreSQL adapter is  
significantly faster (up to 3-4 times faster than before).

- Instantiating model objects has been made much faster, as many  
options (such as raise\_on\_save\_failure) are now lazily loaded, and  
hook methods are now much faster if no hooks have been defined for  
that type of hook.

## New Association Options

- The :eager\_grapher option has been added allowing you to supply  
your own block to implement eager loading via eager\_graph.

- many\_to\_one and one\_to\_many associations now have a :primary\_key  
option, specifying the name of the column that the :key option  
references.

- many\_to\_many associations now have :left\_primary\_key and  
:right\_primary\_key options, specifying the columns that :left\_key  
and :right\_key reference, respectively.

- many\_to\_many associations now have a :uniq option, that adds an  
:after\_load callback that makes the returned array of objects  
unique.

## Other New Features

- Dataset#set\_graph\_aliases now allows you to supply a third argument  
for each column you want graph into the dataset, allowing you to use  
arbitrary SQL expressions that are graphed into the correct table:

- Dataset#add\_graph\_aliases was added, that adds additional graph  
aliases instead of replacing the existing ones (as  
#set\_graph\_aliases does). It’s basically the equivalent of  
select\_more for graphs.

- Dataset#join\_table changed it’s final argument from a symbol  
specifying a table name to an option hash (with backwards  
compatibility kept), and adds support for a :implicit\_qualifier  
option, which it uses instead of the last joined table to  
qualify columns.

- Association’s :after\_load callbacks are now called when eager  
loading via eager (but not when eager loading via eager\_graph).

- Any expression can now be used as the argument to Symbol#like,  
which means that you can pattern match columns to other columns.  
Before, it always transformed the argument to a string.

- Array#sql\_array was added, allowing you to specify that an array  
in ruby be treated like an array in SQL. This is true anyway,  
except for arrays of all two pairs, which are treated like hashes,  
for specifying multiple conditions with the same key:

- ComplexExpression#== and #sql? were added, allowing for easier  
testing.

- Full text searching on PostgreSQL now joins multiple columns with  
a space, to prevent joining border words, and it works when there  
is a match in one column but the other column is NULL.

## Other Improvements

- Instance methods added by creating associations are added to an  
anonymous module included by the class, so they can be overridden  
in the class while still allowing the use of super to get the  
default behavior (this is similar to column accessor methods).

- Many improvements were added to support using multiple schemas in  
PostgreSQL.

- Model::Validation::Errors objects are now more compatible with  
Rails, by adding a #count method and making #on return nil if there  
are no error messages for that attribute.

- Serialized columns in models are no longer typecast.

- Associations are now inherited when a model class is subclassed.

- Many improvements were made that should make adding custom  
association types easier.

- A corner case in eager\_graph where the wrong table name would be  
used to qualify a column name has been fixed.

- Dataset’s cached column information is no longer modified if #each  
is called with an option that modifies the columns.

- You should now be able to connect to Oracle via the JDBC adapter,  
and with the same support it has when using the oracle adapter.

- Model.association\_reflections is now a public methods, so you can  
grab a hash of all association reflections at once (keyed by  
association name symbol).

- The :encoding/:charset option now works in the PostgreSQL adapter  
if the postgres-pr driver is used.

- The numeric(x,y) type is now interpreted as decimal.

## Backwards Compatibilty

- The first argument to Model#initialize must be a hash, you can no  
longer use nil. For example, the following code will break if  
:album is not in params:

- The Sequel::Model.lazy\_load\_schema setting was removed. It should  
no longer be necessary now that schema loading is relatively speedy,  
and schemas can be loaded at startup and cached.

- The PostgreSQL adapter will default to using a unix socket in /tmp  
if no host is specified. Before, a TCP/IP socket to localhost was  
used if no host was specified. This change makes Sequel operate  
similarly to the PostgreSQL command line tools.

- The ASSOCIATION\_TYPES constant has changed from an array to a hash  
and it has been moved. The RECIPROCAL\_ASSOCIATIONS constant has  
been removed. This is unlikely to matter unless you were using  
custom association types.

- The PostgreSQL adapter now sets the PostgreSQL DateStyle, in order  
to implement an optimization. To turn this off, set  
Sequel::Postgres.use\_iso\_date\_format = false.

- When using the PostgreSQL adapter, in many places the schema is  
specified explicitly. If you do not specify a schema, a default  
one is used (public by default). If you use a schema other than  
public for your work, use Database#default\_schema= to set it. For  
any table outside of the default schema, you should specify the  
schema explicitly, even if it is in the PostgreSQL search\_path.

- Model::Validation::Errors#on now returns nil instead of [] if there  
are no errors for an attribute.

- Hooks added to a superclass after a subclass has been created no  
longer have an effect on the subclass.

- The Postgres.string\_to\_bool method has been removed.

- PostgreSQL full text searching now always defaults to using the  
simple dictionary. If you want to use another dictionary, it must  
be specified explicitly, both when searching and when creating a  
full text index.

Thanks,  
Jeremy

- {Website}[[http://sequel.rubyforge.org](http://sequel.rubyforge.org)]
- {Source code}[[GitHub - jeremyevans/sequel: Sequel: The Database Toolkit for Ruby](http://github.com/jeremyevans/sequel)]
- {Bug tracking}[[Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/ruby-sequel/issues/list)]
- {Google group}[[http://groups.google.com/group/sequel-talk](http://groups.google.com/group/sequel-talk)]
- {RDoc}[[http://sequel.rubyforge.org/rdoc](http://sequel.rubyforge.org/rdoc)]
