Forum: Ruby Sequel 0.0.9 - Concise ORM for Ruby

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
6d21f1858dda3716c76cd2a7f92ca08f?d=identicon&s=25 Sharon Rosner (ciconia)
on 2007-03-26 10:50
(Received via mailing list)
Sequel is a new ORM tool for Ruby. Sequel provides the following

* Thread safety and connection pooling. You can write multi-threaded
applications that connect to databases without worrying about handling
* 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
* Currently has adapters for Postgresql, SQLite and MySQL (preliminary
* Model classes work in similar fashion to ActiveRecord (but are
currently missing some functionality.)

RDoc documentation is here:
The source code is here:

A Short Example:

require 'sequel/sqlite'

# open an in-memory SQLite database
DB = 'sqlite:/:memory:'

# create a table
DB.create_table :items do
  primary_key :id, :integer, :auto_increment => true
  column :name, :text
  column :price, :float

# 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 >

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!
This topic is locked and can not be replied to.