# ANN: Sequel 0.3.3 Released

**URL:** <https://rubytalk.org/t/ann-sequel-0-3-3-released/41909>\
**Category:** ruby-talk\
**Created:** [4 November 2007 18:44 UTC](https://rubytalk.org/t/ann-sequel-0-3-3-released/41909 "2007-11-04T18:44:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sharon\_Rosner](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@Sharon\_Rosner](https://rubytalk.org/u/Sharon_Rosner)\
**Post date:** [4 November 2007 18:44 UTC](https://rubytalk.org/t/ann-sequel-0-3-3-released/41909/1 "2007-11-04T18:44:53Z")

</div>

Sequel version 0.3.3 has just been released. This release includes  
extensions for easily specifying relative time stamps and a simple  
worker thread implementation for asynchronous processing.

Sequel is a lightweight 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:

=== Numeric Extensions

Sequel now includes extensions to the Numeric class to make it easier  
to specify time units and relative time stamps. This feature is based  
on the functionality provided in Rails. These extensions are disabled  
by default. To enable numeric extensions, include the following in  
your code:

&nbsp;&nbsp;Sequel::NumericExtensions.enable

You can easily specify time in minute, hour, day and week units:

&nbsp;&nbsp;1.minute #=\> 60  
&nbsp;&nbsp;2.hours #=\> 7200  
&nbsp;&nbsp;3.days #=\> 3 \* 86400  
&nbsp;&nbsp;1.week #=\> 7 \* 86400

You can also specify time relative to the current time using #from\_now  
and #ago:

&nbsp;&nbsp;3.hours.from\_now  
&nbsp;&nbsp;1.week.ago

And also time relative to a given time stamp:

&nbsp;&nbsp;3.hours.before(t)  
&nbsp;&nbsp;4.days.since(t)

=== Worker threads

Sequel now includes a worker thread implementation, which can be  
useful in cases where you need to perform database operations while  
iterating over records. Jobs are added to the worker by calling  
Worker#add with a block:

&nbsp;&nbsp;worker = Sequel::Worker.new  
&nbsp;&nbsp;Item.filter(:active =\> true).each do |i|  
&nbsp;&nbsp;&nbsp;&nbsp;worker.add {i.set(:name =\> i.name.capitalize)}  
&nbsp;&nbsp;end  
&nbsp;&nbsp;worker.join

You can also have the worker wrap all its jobs with a transaction by  
specifying a database when creating a new worker:

&nbsp;&nbsp;worker = Sequel::Worker.new(DB) #transaction is begun  
&nbsp;&nbsp;Item.filter(:active =\> true).each do |i|  
&nbsp;&nbsp;&nbsp;&nbsp;worker.add {i.set(:name =\> i.name.capitalize)}  
&nbsp;&nbsp;end  
&nbsp;&nbsp;worker.join # transaction is commited

=== More info

Sequel project page:  
&nbsp;&nbsp;\<[http://code.google.com/p/ruby-sequel](http://code.google.com/p/ruby-sequel)\>

Sequel documentation:  
&nbsp;&nbsp;\<[http://sequel.rubyforge.org](http://sequel.rubyforge.org)\>

Join the Sequel-talk group:  
&nbsp;&nbsp;\<[http://groups.google.com/group/sequel-talk](http://groups.google.com/group/sequel-talk)\>

Install the gem:  
&nbsp;&nbsp;sudo gem install sequel

Or check out the source and install manually:  
&nbsp;&nbsp;svn co [http://ruby-sequel.googlecode.com/svn/trunk](http://ruby-sequel.googlecode.com/svn/trunk) sequel  
&nbsp;&nbsp;cd sequel  
&nbsp;&nbsp;rake install
