Sequel is a lightweight database access toolkit for Ruby.
- Sequel provides thread safety, connection pooling and a concise
DSL for constructing SQL queries and table schemas.
- Sequel includes a 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, savepoints,
two-phase commit, transaction isolation, master/slave
configurations, and database sharding.
- Sequel currently has adapters for ADO, Amalgalite, DataObjects,
DB2, DBI, Firebird, Informix, JDBC, MySQL, Mysql2, ODBC, OpenBase,
Oracle, PostgreSQL and SQLite3.
Sequel 3.15.0 has been released and should be available on the gem
= Performance Enhancements
A mysql2 adapter was added to Sequel. It offers a large (2-6x)
performance increase over the standard mysql adapter. In order to
use it, you need to install mysql2, and change your connection
strings to use mysql2:// instead of mysql://.
Support for sequel_pg was added to the native postgres adapter,
when pg is being used as the backend. sequel_pg also offers a
large (2-6x) performance increase over the default row fetching
code that the Sequel postgres adapter uses. In order to use it,
you just need to install sequel_pg, and the postgres adapter will
pick it up automatically.
Mass assignment has been made about 10x faster by caching the
allowed setter methods in the model.
= Other Improvements
The following construct is now safe to use in environments that
reload code without unloading existing constants:
class MyModel < Sequel::Model(DB[:table])
Previously, this would raise a superclass mismatch TypeError.
Sequel now handles the case where both an implicit and an explicit
table alias are given to join_table, preferring the explicit alias.
This can happen if you are using models with aliased table names
and eager graphing them. Previously, this would result in invalid
SQL, with both aliases being used.
You can use use an aliased table for the :join_table option
of a many_to_many association.
The active_model plugin now supports the final release of
Typecasting now works correctly for attributes loaded lazily
when using the lazy_attributes plugin.
The class_table_inheritance plugin now works with non-integer
primary keys on SQLite.
Temporary tables are now ignored when parsing the schema on
On MySQL, an :auto_increment key with a true value is added to
the Database#schema output hash if the related column is
The mysql adapter now handles Mysql::Error exceptions raised when
On SQLite, emulated alter_table commands that require dropping
the table now preserve the foreign key information, if SQLite
foreign key support is enabled (it is by default).
DSN-less connections now work correctly in more cases in the
A workaround has been added for a bug in the Microsoft SQL
Server JDBC Driver 3.0, involving it incorrectly returning a
smallint instead of a char type for the IS_AUTOINCREMENT
An bug in the error handling when connecting to PostgreSQL using
the do (DataObjects) adapter has been fixed.
= Backwards Compatibility
The caching of allowed mass assignment methods can result in the
incorrect exception class being raised if you manually undefine
instance setter methods in the model class. If you do this, you
need to clear the setter methods cache manually: