# ANN: Sequel 3.2.0 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-3-2-0-released/171452>\
**Category:** Ruby\
**Created:** [July 2, 2009, 6:29pm UTC](https://www.ruby-forum.com/t/ann-sequel-3-2-0-released/171452 "2009-07-02T18:29:34Z")\
**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:** [July 2, 2009, 6:29pm UTC](https://www.ruby-forum.com/t/ann-sequel-3-2-0-released/171452/1 "2009-07-02T18:29:34Z")

</div>

Sequel is a lightweight database access toolkit for Ruby.

- 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, stored procedures, 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, Amalgalite, DataObjects,  
DB2, DBI, Firebird, Informix, JDBC, MySQL, ODBC, OpenBase, Oracle,  
PostgreSQL and SQLite3.

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

## New Features

- Common table expressions (CTEs) are now supported. CTEs use the  
SQL WITH clause, and specify inline views that queries can use.  
They also support a recursive mode, where the CTE can recursively  
query its own output, allowing you do do things like load all  
branches for a given node in a plain tree structure.

- SQL window functions are now supported, and a DSL has been added to  
ease their creation. Window functions act similarly to aggregate  
functions but operate on sliding ranges of rows.

- Schema information for columns now includes a :ruby\_default entry  
which contains a ruby object that represents the default given by  
the database (which is stored in :default). Not all :default  
entries can be parsed into a :ruby\_default, but if the  
schema\_dumper extension previously supported it, it should work.

- Methods to create compound datasets (union, intersect, except), now  
take an options hash instead of a true/false flag. The previous  
API is still supported, but switching to specifying the ALL setting  
using :all=\>true is recommended.

- Dataset#ungraphed was added that removes the graphing information  
from the dataset. This allows you to use Dataset#graph for the  
automatic aliasing, or #eager\_graph for the automatic aliasing and  
joining, and then remove the graphing information so that the  
resulting objects will not be split into subhashes or associations.

- There were some introspection methods added to Dataset to describe  
which capabilities that dataset does or does not support:

- Dataset#qualify was added, which is like qualify\_to with a default  
of first\_source.

- You can now specify the table and column Sequel::Migrator will use  
to record the current schema version. The new Migrator.run method  
must be used to use these new options.

- The JDBC adapter now accepts :user and :password options, instead  
of requiring them to be specified in the connection string and  
handled by the JDBC driver. This should allow connections to  
Oracle using the Thin JDBC driver.

- You can now specify the max\_connections, pool\_timeout, and  
single\_threaded settings directly in the connection string:

- Dataset#on\_duplicate\_key\_update now affects Dataset#insert when  
using MySQL.

- You can now specify the :opclass option when creating PostgreSQL  
indexes. Currently, this only supports a single operator class  
for all columns. If you need different operator classes per  
column, please post on sequel-talk.

- Model#autoincrementing\_primary\_key was added and can be used if  
the autoincrementing key isn’t the same as the primary key. The  
only likely use for this is on MySQL MyISAM tables with composite  
primary keys where only one of the composite parts is  
autoincrementing.

- You can now use database column values as search patterns and  
specify the text to search as a String or Regexp:

- The Dataset#dataset\_alias private method was added. It can be  
overridden if you have tables named t0, t1, etc and want to make  
sure the default dataset aliases that Sequel uses do not clash  
with existing table names.

- Sequel now raises an Error if you call Sequel.connect with  
something that is not a Hash or String.

- bin/sequel now accepts a -N option to not test the database  
connection.

- An opening\_databases.rdoc file was added to the documentation  
directory, which should be a good introduction for new users about  
how to set up your Database connection.

## Other Improvements

- MySQL native adapter SELECT is much faster than before, up to 75%  
faster.

- JDBC SELECT is about 10% faster than before. It’s still much  
slower than the native adapters, due to conversion issues.

- bin/sequel now works with a YAML file on ruby 1.9.

- MySQL foreign key table constraints have been fixed.

- Database#indexes now works on PostgreSQL if the schema used is a  
Symbol. It also works on PostgreSQL versions all the way back to  
7.4.

- Graphing of datasets with dataset sources has been fixed.

- Changing a columns name, type, or NULL status on MySQL now  
supports a much wider selection of column defaults.

- The stored procedure code is now thread-safe. Sequel is  
thread-safe in general, but due to a bug the previous stored  
procedure code was not thread-safe.

- The ODBC adapter now drops statements automatically instead of  
requiring the user to do so manually, making it more similar  
to other adapters.

- The single\_table\_inheritance plugin no longer overwrites the STI  
field if the field already has a value. This allows you to use  
create in the generic class to insert a value that will be  
returned as a subclass:

- When altering colums on MySQL, :unsigned, :elements, :size and other  
options given are no longer ignored.

- The PostgreSQL shared adapter’s explain and analyze methods have  
been fixed, they had been broken in 3.0.

- Parsing of the server’s version is more robust on PostgreSQL.  
It should now work correctly for 8.4 and 8.4rc1 type versions.

## Backwards Compatibility

- Dataset#table\_exists? has been removed, since it never worked  
perfectly. Use Database#table\_exists? instead.

- Model.grep now calls Dataset#grep instead of Enumerable#grep.  
If you are using Model.grep, you need to modify your application.

- The MSSQL shared adapter previously used the :with option for  
storing the NOLOCK setting of the query. That option has been  
renamed to :table\_options, since :with is now used for CTEs.  
This should not have an effect unless you where using the option  
manually.

- Previously, providing a block to a method calls in virtual row  
blocks did not change behavior, where now it causes a different  
code path to be used. In both cases, the block is not evaluated,  
but that may change in a future version.

- Dataset#to\_table\_reference protected method was removed, as it was  
no longer used.

- The pool\_timeout setting is now converted to an Integer, so if you  
used to pass in a Float, it no longer works the same way.

- Most files in adapters/utils have been removed, in favor of  
integrating the code directly into Database and Dataset. If you  
were previously checking for the UnsupportedIntersectExcept or  
related modules, use the Dataset introspection methods instead  
(e.g. supports\_intersect\_except?).

- If you were using the ODBC adapter and manually dropping returned  
statements, you should note that now statements are dropped  
automatically, and the execute method doesn’t return a statement  
object.

- The MySQL adapter on\_duplicate\_key\_update\_sql is now a private  
method.

- If you were modifying the :from dataset option directly, note that  
Sequel now expects this option to be preprocessed. See the new  
implementation of Dataset#from for an idea of the changes  
required.

- Dataset#simple\_select\_all? now returns false instead of true for a  
dataset that selects from another dataset.

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)]
