# ANN: Sequel 2.10.0 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-2-10-0-released/159359>\
**Category:** Ruby\
**Created:** [February 3, 2009, 8:16pm UTC](https://www.ruby-forum.com/t/ann-sequel-2-10-0-released/159359 "2009-02-03T20:16:08Z")\
**Posts on this page:** 3\
**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:** [February 3, 2009, 8:16pm UTC](https://www.ruby-forum.com/t/ann-sequel-2-10-0-released/159359/1 "2009-02-03T20:16:08Z")

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

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

## New Supported Adapters and Databases

- A DataObjects adapter was added that supports PostgreSQL,  
MySQL, and SQLite. DataObjects is the underlying database  
library used by DataMapper, and has potential performance  
advantages by doing all typecasting in C.

- A Firebird Adapter was added, it requires the modified Ruby  
Fb adapter found at [GitHub - wishdev/fb: Firebird Extension Library for Ruby](http://github.com/wishdev/fb).

- An H2 JDBC subadapter was added, based on the code used in JotBot.  
H2 is an embeddable Java database, and may be preferable to using  
SQLite on JDBC because SQLite requires native code.

## New Core Features

- Sequel now has database independent migrations. Before, column  
types in migrations were not translated per database, so it was  
difficult to set up a migration that worked on multiple databases.  
Sequel now accepts ruby classes as database types, in addition to  
symbols and strings. If a ruby class is used, it is translated  
to the most appropriate database type. Here is an example using  
all supported classes (with Sequel’s default database type):

- A ton of internal work was done to better support databases that  
fold unqouted identifiers to uppercase (which is the SQL standard).  
Sequel now allows you to set a method to call on identifiers going  
both into and out of the database. The default is to downcase  
identifiers coming out, and upcase identifiers going in, though  
this is overridden by the PostgreSQL, MySQL, and SQLite adapters  
to not do anything (since they fold to lowercase by default).

- Schema parsing support was added to the JDBC adapter, using the  
JDBC metadata methods. This means that models that use the  
JDBC adapter will typecast data in their column setters and  
automatically select the correct primary key column(s). This is  
currently the only adapter that supports schema parsing when using  
an MSSQL or Oracle database.

- Database#create\_table now takes options, which you can use to  
specify a MySQL engine, charset, and/or collation. You can also  
set a default engine, charset, and collation for MySQL to use:

- The Sequel::DatabaseConnectionError exception class was added. It  
is raised by the connection pool if there is an error attempting  
to instantiate a database connection. Also, if the adapter returns  
nil instead of raising an error for faulty connection parameters,  
DatabaseConnectionError will be raised immediately, instead of the  
connection pool busy waiting until if gives up with a  
PoolTimeoutError.

- Database#tables is now supported on the JDBC adapter, returning  
an Array of table name symbols.

- Sequel now converts the following Java types returned by the JDBC  
adapter into ruby types: Java::JavaSQL::Timestamp,  
Java::JavaSQL::Time, Java::JavaSQL::Date,  
Java::JavaMath::BigDecimal, and Java::JavaIo::BufferedReader.

- When using the PostgreSQL adapter with the postgres-pr driver,  
Sequel will use a custom string escaping routine unless  
force\_standard\_strings = false. This means that using Sequel’s  
defaults, postgres-pr will correctly escape strings now.

- The SQLite adapter now returns float, real, and double precision  
columns as Floats.

- The SQLite adapter logs beginning, committing, and rolling back  
transactions.

- Sequel now has an internal version (before, the only way to tell  
the version was to look at the gem being used). It is accessible  
at Sequel.version.

## New Model Features

- A new validates\_not\_string validation was added for Sequel Models.  
It is intended to be used with the raise\_on\_typecast\_failure =  
false setting. In this case, for a non-string database column,  
if there is a string value when the record is going to be  
saved, it is due to the fact that Sequel was not able to typecast  
the given data correctly (so it is almost certainly not valid).  
This should make Sequel easier to use with web applications.

- An :allow\_missing validation option was added to all standard  
validations. This option skips the validation if the attribute  
is not in the object’s values. It is different from :allow\_nil,  
which will skip the value if it is present but nil in the values.  
The intended use case for this option is when the database provides  
a good default. If the attribute is not present in values, the  
database will use its default. If the attribute is present in  
the values but equals nil, Sequel will attempt to insert it into  
the database as a NULL value, instead of using the database’s  
default. If you don’t want Sequel to insert a NULL value in the  
database, but you want the database to provide the default, this  
is the option to use.

- validates\_each now accepts :allow\_nil and :allow\_blank options,  
so it is easier to create custom validations with the same options  
as the standard validations.

- Before\_\* hooks now run in the reverse order that they were added.  
The purpose of hooks is to wrap existing functionality, and making  
later before\_\* hooks run before previous before\_\* hooks is the  
correct behavior.

- You can now add you own hook types, via Model.add\_hook\_type. This  
is intended for plugin use. All of the standard hooks are now  
implemented using this method.

- The value of new? in a after\_save hook now reflects the  
previous state of the model (so true for a create and false for an  
update), instead of always being false. This makes it easier  
to have a complex after\_save hook that still needs to  
differentiate between a newly created record and an updated record,  
without having to add separate after\_create and after\_update  
hooks.

- The value of changed\_columns in an after\_update hook now reflects  
the value before the update occurred, instead of usually being  
empty. Previously, to have this functionality, you generally had  
to save the value to an instance variable in a before\_update hook  
so you could reference it in the after\_update hook.

## Other Improvements

- Sequel now longer overwrites the following Symbol instance methods  
when running on ruby 1.9: [], \<, \<=, \>, and \>=. One of Sequel’s  
principals is that it does not override methods defined by ruby,  
and now that ruby 1.9 defines the above methods on Symbol, Sequel  
shouldn’t be overwriting them.

- Database#quote\_identifiers now affects future schema modifications  
when using the database. Previous, it only affected future  
schema modifications if a schema modification method had not yet  
been called.

- Literalization of Times and DateTimes is now correct when using the  
MySQL JDBC subadapter.

- Literalization of Blobs is now correct when using the PostgreSQL  
JDBC subadapter.

- Index and table names are quoted when creating indices in the  
PostgreSQL adapter.

- Dataset#delete was changed in the SQLite adapter to add a  
where clause that is always true, instead of doing an explicit  
count first and the deleting. This is simpler, though it  
could potentially have performance implications.

- The sequel command line tool now supports symbol keys and unnested  
hashes in YAML files, so it should work with Merb’s database.yml.  
It also includes the error class in the case of an error.

- The integration type tests were greatly expanded. Generally,  
running the integration tests is a good way to determine how well  
your database is supported.

- Dataset#quote\_identifier now returns LiteralStrings as-is, instead  
of treating them as regular strings.

- Sequel no longer modifies the MySQL::Result class when using the  
MySQL adapter.

## Backwards Compatibilty

- If you were previously using a database that returned uppercase  
identifiers, it will probably return lowercase identifiers by  
default now. To get back the old behavior:

- The module hierarchy under Sequel::SQL has changed. Now,  
modules do not include other modules, and the following modules  
were removed since they would have been empty after removing  
the modules they included: Sequel::SQL::SpecificExpressionMethods  
and Sequel::SQL::GenericExpressionMethods.

- Sequel no longer assumes the public schema by default when  
connecting to PostgreSQL. You can still set the default  
schema to use (even to public).

- The ability to load schema information for all tables at once  
was removed from the PostgreSQL adapter. While it worked, it had  
some issues, and it was difficult to keep it working when some  
new features were used. This ability wasn’t exposed to the user,  
and was purely an optimization. If you have any code like:

- The Database#primary\_key API changed in the PostgreSQL shared  
adapter, it now accepts an options hash with :server and :conn keys  
instead of a server symbol. Also, quite a few private Database  
instance methods changed, as well as some constants in the  
AdapterMethods.

- It is possible that some migrations will break, though it is  
unlikely. If you were using any of the classes mentioned above  
as a method inside a migration, it might be broken. However,  
since String, Float, and Integer wouldn’t have worked as methods  
before, it is unlikely that anyone used this.

- The meaning of #String, #Integer, and #Float inside  
Sequel::SQL::Generator (i.e. inside a Database#create\_table  
block) has changed. Before, these used to call private Kernel  
methods, now, they set up columns with the appropriate database  
type.

- The Database#lowercase method in the DBI adapter was removed,  
as its use case is now met by the identifier\_output\_method support.

- Database#uri is now aliased explicitly via a real method, to  
allow for easier subclassing.

- You can no longer pass nil as the second argument to  
Database#create\_table.

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

---

<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:** [February 3, 2009, 10:14pm UTC](https://www.ruby-forum.com/t/ann-sequel-2-10-0-released/159359/2 "2009-02-03T22:14:43Z")

</div>

Very nice, congrats. And a very nice release announcement too 🙂

---

<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:** [February 3, 2009, 10:50pm UTC](https://www.ruby-forum.com/t/ann-sequel-2-10-0-released/159359/3 "2009-02-03T22:50:01Z")

</div>

Jeremy E. wrote:

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

Very cool! Thanks for the hard work.

–  
James B.

[www.happycamperstudios.com](http://www.happycamperstudios.com) - Wicked Cool Coding  
[www.jamesbritt.com](http://www.jamesbritt.com) - Playing with Better Toys  
[www.ruby-doc.org](http://www.ruby-doc.org) - Ruby Help & Documentation  
[www.rubystuff.com](http://www.rubystuff.com) - The Ruby Store for Ruby Stuff
