ANN: Sequel 0.4.2 Released

Sequel version 0.4.1 has just been released. This release includes a
new plugin system for models, new experimental adapters, and
enhancements to Sequel models.

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.

Following is a discussion of the changes.

=== Plugins for Sequel models

New in this release is as plugin system for enhancing model classes
with common functionality. Plugins are automatically loaded when used
in a model class, and enhance the model class with instance, class and
dataset methods.

The first plugin for Sequel is orderable, which allows model instances
to be part of an ordered list, based on a ‘position’ field in the
database. Basic usage is as follows:

class Item < Sequel::Model(:items)
is :orderable

You can also specify the field used for determining the position by
specifying a :field option:

class Item < Sequel::Model(:items)
is :orderable, :field => :my_pos_field

The orderable plugin is installed as a separate gem:

sudo gem install sequel_orderable

More plugins are currently being developed, including: accountable,
dequeue, linked_list, poset, queue, searchable, stack, taggable, tree
and versioned.

=== Experimental JDBC adapter

New in this release is an experimental adapter for JDBC, which might
prove useful for JRuby users. Since JDBC requires explicit loading of
drivers and has its own conventions for connection strings, connecting
to a database is a bit different than other Sequel adapters:

require ‘sequel’
require ‘sequel/adapters/jdbc’

DB = Sequel.jdbc(“mysql://”)

The JDBC adapter will probably need more work, so feedback would be
greatly appreciated.

=== Improvements to Sequel models

Model instances now keep track of changes to field values, provided
values are changed using the attribute writer methods, or through
Model#[]= calls. Changes can be tracked by calling

item = Item.first
item.changed_columns #=> []
item.category = ‘ruby’
item.changed_columns #=> [:category]

Changes can be saved by calling Model#save_changes:

item.category = ‘sequel’
item.save_changes # will update the category field only

Also, the Model#save method can now accept a list of specific fields
to save, e.g.:, :name)

=== Miscellanea

  • Implemented experimental OpenBase adapter.

  • Implemented odbc-mssql adapter (thanks Dusty.) This adapter offers
    support for limiting the number of records selected and using NO LOCK
    with MSSQL databases.

  • Fixed Sequel. methods to accept options hash as well as
    database name. Fixed Sequel.connect to accept options hash as well as

  • Fixed #first and #last functionality in Informix::Dataset (thanks
    Gerardo S.).

=== More info

Sequel project page:

Sequel documentation:

Join the Sequel-talk group:

Install the gem:
sudo gem install sequel

Or check out the source and install manually:
svn co sequel
cd sequel
rake install