J
Jeremy Evans
Sequel is a database access toolkit for Ruby. Sequel provides thread
safety, connection pooling, and a concise DSL for constructing queries
and table schemas.
Sequel makes it easy to deal with multiple records without having to
break your teeth on SQL.
Sequel 1.4.0 has been released and should be avaiable on the gem mirrors
shortly. 1.4.0 has the following exciting new features:
Eager loading for all types of associations:
Artist.eageralbums).all
Album.eagerartist, :genre, :tracks).all
Album.eagerartist).eagergenre).eagertracks).all
Album.filteryear=>2008).eagerartist).all
Eager loading supports cascading to an unlimited depth, and doesn't have
any aliasing issues:
Artist.eageralbums=>:tracks).all
Artist.eageralbums=>{:tracks=>:genre}).all
Unfortunately, eager loading comes at the expense of a small amount of
backward compatibility. If you were using uncached associations (the
default in sequel_model 0.5), they no longer work the same way. Now,
all associations act as if :cache=>true (which is now set for all
associations, so if you wrote a tool that worked with both cached and
uncached associations, it should still work).
One to many associations now populate the corresponding many to one
instance variable (even when eagerly loaded):
# Assuming: Album.one_to_many :tracks
album = Album.first
# This following code is only one query,
# not a query for the album and one for each track
album.tracks.each{|t| puts t.album.name}
ActiveRecord style has_many :through associations are now supported via
many_to_many. many_to_many will no longer select the entire result set,
just the columns of the associated table (and not the join table), so it
works for both has_and_belongs_to_many (simple join table) and has_many
:through (join table model) scenarios. If you want to include all or
part of the join table attributes, see the :select option for
many_to_many associations.
We reduced the number of gems from three (sequel, sequel_core,
sequel_model) to two (sequel, sequel_core). Basically, sequel_model is
now just sequel, and the old sequel gem metapackage is no longer. There
isn't a reason to have a gem metapackage for two gems when one
(sequel_model) depends on the other (sequel_core). This required a
version bump for the model part of sequel from 0.5.0.2 to 1.4.0 (since
the previous sequel gem version was 1.3).
Sequel 1.4.0 has fixes for 11 trackers issues, including fixes to the
MySQL and PostgreSQL adapters.
We have switched the source control repository for Sequel from Google
Code (which uses subversion) to github (which uses git). If you would
like to contribute to Sequel, please fork the github repository, make
your changes, and send a pull request. As before, posting patches on
the Google Code issue tracker is fine as well.
If you have any questions, please post on the Google Group.
Thanks,
Jeremy
* {Project page}[http://code.google.com/p/ruby-sequel/]
* {Source code}[http://github.com/jeremyevans/sequel]
* {Bug tracking}[http://code.google.com/p/ruby-sequel/issues/list]
* {Google group}[http://groups.google.com/group/sequel-talk]
* {RubyForge page}[http://rubyforge.org/projects/sequel/]
* {API RDoc}[http://sequel.rubyforge.org]
safety, connection pooling, and a concise DSL for constructing queries
and table schemas.
Sequel makes it easy to deal with multiple records without having to
break your teeth on SQL.
Sequel 1.4.0 has been released and should be avaiable on the gem mirrors
shortly. 1.4.0 has the following exciting new features:
Eager loading for all types of associations:
Artist.eageralbums).all
Album.eagerartist, :genre, :tracks).all
Album.eagerartist).eagergenre).eagertracks).all
Album.filteryear=>2008).eagerartist).all
Eager loading supports cascading to an unlimited depth, and doesn't have
any aliasing issues:
Artist.eageralbums=>:tracks).all
Artist.eageralbums=>{:tracks=>:genre}).all
Unfortunately, eager loading comes at the expense of a small amount of
backward compatibility. If you were using uncached associations (the
default in sequel_model 0.5), they no longer work the same way. Now,
all associations act as if :cache=>true (which is now set for all
associations, so if you wrote a tool that worked with both cached and
uncached associations, it should still work).
One to many associations now populate the corresponding many to one
instance variable (even when eagerly loaded):
# Assuming: Album.one_to_many :tracks
album = Album.first
# This following code is only one query,
# not a query for the album and one for each track
album.tracks.each{|t| puts t.album.name}
ActiveRecord style has_many :through associations are now supported via
many_to_many. many_to_many will no longer select the entire result set,
just the columns of the associated table (and not the join table), so it
works for both has_and_belongs_to_many (simple join table) and has_many
:through (join table model) scenarios. If you want to include all or
part of the join table attributes, see the :select option for
many_to_many associations.
We reduced the number of gems from three (sequel, sequel_core,
sequel_model) to two (sequel, sequel_core). Basically, sequel_model is
now just sequel, and the old sequel gem metapackage is no longer. There
isn't a reason to have a gem metapackage for two gems when one
(sequel_model) depends on the other (sequel_core). This required a
version bump for the model part of sequel from 0.5.0.2 to 1.4.0 (since
the previous sequel gem version was 1.3).
Sequel 1.4.0 has fixes for 11 trackers issues, including fixes to the
MySQL and PostgreSQL adapters.
We have switched the source control repository for Sequel from Google
Code (which uses subversion) to github (which uses git). If you would
like to contribute to Sequel, please fork the github repository, make
your changes, and send a pull request. As before, posting patches on
the Google Code issue tracker is fine as well.
If you have any questions, please post on the Google Group.
Thanks,
Jeremy
* {Project page}[http://code.google.com/p/ruby-sequel/]
* {Source code}[http://github.com/jeremyevans/sequel]
* {Bug tracking}[http://code.google.com/p/ruby-sequel/issues/list]
* {Google group}[http://groups.google.com/group/sequel-talk]
* {RubyForge page}[http://rubyforge.org/projects/sequel/]
* {API RDoc}[http://sequel.rubyforge.org]