# Sequel 0.0.9 - Concise ORM for Ruby

**URL:** <https://www.ruby-forum.com/t/sequel-0-0-9-concise-orm-for-ruby/90137>\
**Category:** Ruby\
**Created:** [March 26, 2007, 10:50am UTC](https://www.ruby-forum.com/t/sequel-0-0-9-concise-orm-for-ruby/90137 "2007-03-26T10:50:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciconia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@ciconia](https://www.ruby-forum.com/u/ciconia)\
**Post date:** [March 26, 2007, 10:50am UTC](https://www.ruby-forum.com/t/sequel-0-0-9-concise-orm-for-ruby/90137/1 "2007-03-26T10:50:55Z")

</div>

Sequel is a new ORM tool for Ruby. Sequel provides the following  
features:

- Thread safety and connection pooling. You can write multi-threaded  
applications that connect to databases without worrying about handling  
connections.
- A concise, chainable query DSL lets you stay close to the metal  
without writing SQL. You don’t have to define model classes.
- Datasets support filtering, ordering, summarizing, and joining.
- Records are fetched one at a time, so you can work with huge result  
sets.
- Currently has adapters for Postgresql, SQLite and MySQL (preliminary  
support).
- Model classes work in similar fashion to ActiveRecord (but are  
currently missing some functionality.)

RDoc documentation is here: [http://sequel.rubyforge.org](http://sequel.rubyforge.org)  
The source code is here: [http://ruby-sequel.googlecode.com/svn/trunk](http://ruby-sequel.googlecode.com/svn/trunk)

A Short Example:

require ‘sequel/sqlite’

# open an in-memory SQLite database

DB = Sequel.open ‘sqlite:/:memory:’

# create a table

DB.create\_table :items do  
primary\_key :id, :integer, :auto\_increment =\> true  
column :name, :text  
column :price, :float  
end

# popuplate table

100.times {DB[:items] \<\< {:name =\> “product#{rand(1000)}”, :price =\>  
rand \* 100}}

# create a dataset of highest priced products with a price over 70

expensive\_stuff = DB[:items].filter(‘price \>  
70’).reverse\_order(:price).limit(10)

puts “There are #{expensive\_stuff.count} expensive items.”

puts “Most expensive items (in descending order)”  
expensive\_stuff.each {|i| puts “#{i[:name]} = #{i[:price]}”}

# print average of most expensive products

puts “Average of expensive stuff: #{expensive\_stuff.avg(:price)}”

* * *

Sequel is in an early stage of development, so some things might be  
broken. I appreciate any comments as well as bug reports. Enojy!
