# ANN: Sequel 3.9.0 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-3-9-0-released/184581>\
**Category:** Ruby\
**Created:** [March 4, 2010, 9:17pm UTC](https://www.ruby-forum.com/t/ann-sequel-3-9-0-released/184581 "2010-03-04T21:17:30Z")\
**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:** [March 4, 2010, 9:17pm UTC](https://www.ruby-forum.com/t/ann-sequel-3-9-0-released/184581/1 "2010-03-04T21:17:30Z")

</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.9.0 has been released and should be available on the gem  
mirrors.

## New Features

- The ConnectionPool classes were refactored from 2 separate  
classes to a 5 class hierarchy, with one main class and 4  
subclasses, one for each combination of sharding and threading.

- An optimistic\_locking plugin was added to Sequel::Model. This  
plugin implements a simple database-independent locking mechanism  
to ensure that concurrent updates do not override changes:

- Dataset#unused\_table\_alias was added, which takes a symbol and  
returns either that symbol or a new symbol which can be used as  
a table alias when joining a table to the dataset. The symbol  
returned is guaranteed to not already be used by the dataset:

- The Sequel::ValidationFailed exception now has an errors accessor  
which returns the Sequel::Model::Errors instance with the  
validation errors. This can be helpful in situations where a  
generalized rescue is done where the model object reference is  
not available.

- bin/sequel now works without an argument, which is useful for  
testing SQL generation (and not much else).

- Support SELECT … INTO in the MSSQL adapter, using Dataset#into,  
which takes a table argument.

- You can now provide your own connection pool class via the  
:pool\_class option when instantiating the database.

## Other Improvements

- IN/NOT IN constructs with an empty array are now handled properly.

- If using an IN/NOT IN construct with multiple columns and a dataset  
argument, where multiple column IN/NOT IN support is emulated, a  
separate query is done to get the records, which is then handled  
like an array of values. This means that the following type of  
query now works on all tested databases:

- Schemas and aliases are now handled correctly when eager graphing.

- Implicitly qualified symbols are now handled correctly in update  
statements, useful if you are updating a joined dataset and need  
to reference a column that appears in multiple tables.

- The active\_model plugin has been brought up to date with  
activemodel 3.0 beta (though it doesn’t work on edge).  
Additionally, the active\_model plugin now requires active\_model  
in order to use ActiveModel::Naming.

- In the schema\_dumper extension, always include the varchar limit,  
even if it is 255 columns (the default). This makes it so that  
PostgreSQL will use a varchar(255) column instead of a text column  
when restoring a schema dump of a varchar(255) column from another  
database.

- You can now load adapters from outside the Sequel lib directory,  
now they just need to be in a sequel/adapters directory somewhere  
in the LOAD\_PATH.

- You can now load extensions from outside the Sequel lib directory  
using Sequel.extension. External extensions need to be in a  
sequel/extensions directory somewhere in the LOAD\_PATH.

- Using bound variables for limit and offset in prepared statements  
now works correctly.

- Performance of prepared statements was improved in the native  
SQLite adapter.

- The schema\_dumper extension now passes the options hash from  
dump\_\*\_migration to Database#tables.

- In the single\_table\_inheritance plugin, qualify the sti\_key column  
with the table name, so that subclass datasets can safely be joined  
to other tables having the same column name.

- In the single\_table\_inheritance plugin, handle case where the  
sti\_key value is nil or ‘’ specially, so that those cases  
always return an instance of the main model class. This fixes  
issues if constantize(nil) returns Object instead of raising  
an exception.

- No longer use Date#to\_s for literalization, always use ISO8601  
format for dates.

- A couple lambdas which were instance\_evaled were changed to procs  
for ruby 1.9.2 compatibility.

- MSSQL emulated offset support was simplified to only use one  
subquery, and made to work correctly on ruby 1.9.

- Emulate multiple column IN/NOT IN on H2, since it doesn’t handle  
all cases correctly.

- ODBC timestamps are now handled correctly if the database\_timezone  
is nil.

- ArgumentErrors raised when running queries in the ODBC adapter are  
now raised as DatabaseErrors.

- Attempting to use DISTINCT ON on SQLite now raises an error before  
sending the query to the database.

- The options hash passed to the database connection method is no  
longer modified. However, there may be additional options  
present in Database#opts that weren’t specified by the options  
hash passed to the database connection method.

- Make Dataset#add\_graph\_aliases handle the case where the dataset  
has not yet been graphed.

- You can now provide an SQL::Identifier as a 4th argument to  
Dataset#join\_table, and unsupported arguments are caught and an  
exception is raised.

- The gem specification has been moved out of the Rakefile, so  
that the gem can now be built without rake, and works well with  
gem build and bundler.

- The Rakefile no longer assumes the current directory is in the  
$LOAD\_PATH, so it should work correctly on ruby 1.9.2.

- All internal uses of require are now thread safe.

- Empty query parameter keys in connection strings are now ignored  
instead of raising an exception.

- The specs were changed so that you can run them in parallel.  
Previously there was a race condition in the migration extension  
specs.

## Backwards Compatibility

- If you plan on using sharding at any point, you now must pass  
a :servers option when connecting to the database, even if it is  
an empty hash. You can no longer just call Database#add\_servers  
later.

- The connection\_proc and disconnection\_proc accessors were removed  
from the connection pools, so you can no longer modify the procs  
after the connection pool has been instantiated. You must now  
provide the connection\_proc as the block argument when  
instantiating the pool, and the disconnection\_proc via the  
:disconnection\_proc option.

- In the hash passed to Dataset#update, symbol keys with a double  
embedded underscore are now considerated as implicit qualifiers,  
instead of being used verbatim. If you have a column that includes  
a double underscore, you now need to wrap it in an SQL::Identifier  
or use a String instead.

- The connection pools no longer convert non-StandardError based  
exceptions to RuntimeErrors. Previously, all of the common adapters  
turned this feature off, so there is no change for most users.

- Sequel::ConnectionPool is now considered an abstract class and  
should not be instantiated directly. Use ConnectionPool.get\_pool  
to return an instance of the appropriate subclass.

- The Sequel::SingleThreadedPool constant is no longer defined.

- The private Dataset#eager\_unique\_table\_alias method was removed,  
use the new public Dataset#unused\_table\_alias method instead, which  
has a slightly different API.

- The private Dataset#eager\_graph\_qualify\_order method was removed,  
used Dataset#qualified\_expression instead.

- The private Sequel::Model class methods plugin\_gem\_location and  
plugin\_gem\_location\_old have been removed.

- Gems built with the rake tasks now show up in the root directory  
instead of the pkg subdirectory, and no tarball package is created.

## Other News

- Sequel now has an official blog at [http://sequel.heroku.com](http://sequel.heroku.com).

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)]
- {Blog}[[http://sequel.heroku.com](http://sequel.heroku.com)]
- {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)]
