HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
jeremyevans
sequel
Ruby2010–2024
jeremyevans / sequel

sequel

Sequel: The Database Toolkit for Ruby

19Distinct people
26Mentions
1Explicit recommenders
5.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Sequel: The Database Toolkit for Ruby

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

I work with Ruby on the web, but rarely with Rails. Apart from the Ruby language itself -- which I love, even though I sympathize with those who don't -- I can't imagine giving…

chrisfrank used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year26 dated mentions

Observed mentions: 2010-02-21 16:08:05 UTC to 2024-09-05 07:21:07 UTC.

02462010-01-01 00:00:00 UTC to 2011-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments20102011-01-01 00:00:00 UTC to 2012-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 6 mentions; 3 submissions, 3 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20102010-01-01 00:00:00 UTC2011-01-01 00:00:00 UTC404
20112011-01-01 00:00:00 UTC2012-01-01 00:00:00 UTC000
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC000
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC101
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC202
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC202
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC303
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC110
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC303
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC633

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Sequel: The Database Toolkit for Ruby Sequel is a simple, flexible, and powerful SQL 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, savepoints, two-phase commit, transaction isolation, primary/replica configurations, and database sharding. Sequel currently has adapters for ADO, Amalgalite, IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle, PostgreSQL, SQLAnywhere, SQLite3, TinyTDS, and Trilogy. Resources Website sequel.jeremyevans.net RDoc Documentation sequel.jeremyevans.net/rdoc Source Code github.com/jeremyevans/sequel Bug tracking (GitHub Issues) github.com/jeremyevans/sequel/issues Discussion Forum (GitHub Discussions) github.com/jeremyevans/sequel/discussions Archived Discussion Forum (sequel-talk Google Group) www.mail-archive.com/sequel-talk@googlegroups.com/ If you have questions about how to use Sequel, please ask on GitHub Discussions. Only use the bug tracker to report bugs in Sequel, not to ask for help on using Sequel. To check out the source code: git clone git://github.com/jeremyevans/sequel.git Contact If you have any comments or suggestions please post to the Google group. Installation gem install sequel A Short Example require 'sequel' DB = Sequel.sqlite # memory database, requires sqlite3 DB.create_table :items do primary_key :id String :name Float :price end items = DB[:items] # Create a dataset # Populate the table items.insert(name: 'abc', price: rand * 100) items.insert(name: 'def', price: rand * 100) items.insert(name: 'ghi', price: rand * 100) # Print out the number of records puts "Item count: #{items.count}" # Print out the average price puts "The average price is: #{items.avg(:price)}" The Sequel Console Sequel includes an IRB console for quick access to databases (usually referred to as bin/sequel). You can use it like this: sequel sqlite://test.db # test.db in current directory You get an IRB session with the Sequel::Database object stored in DB. In addition to providing an IRB shell (the default behavior), bin/sequel also has support for migrating databases, dumping schema migrations, and copying databases. See the bin/sequel guide for more details. An Introduction Sequel is designed to take the hassle away from connecting to databases and manipulating them. Sequel deals with all the boring stuff like maintaining connections, formatting SQL correctly and fetching records so you can concentrate on your application. Sequel uses the concept of datasets to retrieve data. A Dataset object encapsulates an SQL query and supports chainability, letting you fetch data using a convenient Ruby DSL that is both concise and flexible. For example, the following one-liner returns the average GDP for countries in the middle east region: DB[:countries].where(region: 'Middle East').avg(:GDP) Which is equivalent to: SELECT avg(GDP) FROM countries WHERE region = 'Middle East' Since datasets retrieve records only when needed, they can be stored and later reused. Records are fetched as hashes, and are accessed using an Enumerable interface: middle_east = DB[:countries].where(region: 'Middle East') middle_east.order(:name).each{|r| puts r[:name]} Sequel also offers convenience methods for extracting data from Datasets, such as an extended map method: middle_east.map(:name) # => ['Egypt', 'Turkey', 'Israel', ...] middle_east.map([:id, :name]) # => [[1, 'Egypt'], [3, 'Turkey'], [2, 'Israel'], ...] Or getting results as a hash via as_hash, with one column as key and another as value: middle_east.as_hash(:name, :area) # => {'Israel' => 20000, 'Turkey' => 120000, ...} Getting Started Connecting to a database To connect to a database you simply provide Sequel.connect with a URL: require 'sequel' DB = Sequel.connect('sqlite://blog.db') # requires sqlite3 The connection URL can also include such stuff as the user name, password, and port: DB = Sequel.connect('postgres://user:password@host:port/database_name') # requires pg You can also specify optional parameters, such as the connection pool size, or loggers for logging SQL queries: DB = Sequel.connect("postgres://user:password@host:port/database_name", max_connections: 10, logger: Logger.new('log/db.log')) It is also possible to use a hash instead of a connection URL, but make sure to include the :adapter option in this case: DB = Sequel.connect(adapter: :postgres, user: 'user', password: 'password', host: 'host', port: port, database: 'database_name', max_connections: 10, logger: Logger.new('log/db.log')) You can specify a block to connect, which will disconnect from the database after it completes: Sequel.connect('postgres://user:password@host:port/database_name'){|db| db[:posts].delete} The DB convention Throughout Sequel’s documentation, you will see the DB constant used to refer to the Sequel::Database instance you create. This reflects the recommendation that for an app with a single Sequel::Database instance, the Sequel convention is to store the instance in the DB constant. This is just a convention, it’s not required, but it is recommended. Note that some frameworks that use Sequel may create the Sequel::Database instance for you, and you might not know how to access it. In most cases, you can access the Sequel::Database instance through Sequel::Model.db. Arbitrary SQL queries You can execute arbitrary SQL code using Database#run: DB.run("create table t (a text, b text)") DB.run("insert into t values ('a', 'b')") You can also create datasets based on raw SQL: dataset = DB['select id from items'] dataset.count # will return the number of records in the result set dataset.map(:id) # will return an array containing all values of the id
Read the full README on GitHub

What Hacker News says

26 sources
Read the rest
sf (ex of functional OOP) https://github.com/r-spatial/sf Ruby * Sequel https://github.com/jeremyevans/sequel/ * Sidekiq https://github.com/sidekiq/sidekiq Rust * ripgrep https://github.com/BurntSushi/ripgrep Scala * fs2 (ex of good type safety) https://github.com/typelevel/fs2 * monix (ex of ugly code with great performance) https://github.com/monix/monix TypeScript * GitHub Desktop (ex of SPA) https://github.com/desktop/desktop --- thanks to: cejast, bb86754, wewxjfq, antonyt, bit, diego_moita, agjmills, freedomben, Contortion, valenterry, DethNinja, mberning, seneca
In Ask HN: What are some of the most elegant codebases in your favorite language?
There's a Ruby ORM called Sequel [0] (Github [1]) which provides a cli [2] to do just that across different databases. Example from the docs - sequel -C mysql://host1/database postgres://host2/database2 or for Postgres > SQLite sequel -C postgres://host2/database2 sqlite://database.sqlite and vice-versa sequel -C sqlite://database.sqlite postgres://host2/database2 [0]: https://sequel.jeremyevans.net [1]: https://github.com/jeremyevans/sequel [2]: https://sequel.jeremyevans.net/rdoc/files/doc/bin_sequel_rdo...
In Migrating from SQLite to PostgreSQL
> Not the subsequent years of maintenance. You're gonna have to pry the Rails from my cold dead fingers if you want me to maintain a web app's database abstraction layer long-term. No other tool works half as well as ActiveRecord. You could maybe convince me to try out https://rom-rb.org/ but only on a brand new project and only if Rails isn't appropriate. If it's a project that wasn't built with Rails, I'm going to want https://github.com/jeremyevans/sequel if ActiveRecord is too much trouble to introduce.
In To ORM or Not to ORM
chrisfrank·Jan 10, 2019Recommendation phrase
I work with Ruby on the web, but rarely with Rails. Apart from the Ruby language itself -- which I love, even though I sympathize with those who don't -- I can't imagine giving up these two libraries by Jeremy Evans: [Sequel](https://github.com/jeremyevans/sequel) - Sequel is the best ORM I've ever used, in any language. Fast, stable, unbelievably well maintained, and offers great low-level access to the database when you need it. [Roda](http://roda.jeremyevans.net) - This dynamic routing library is conceptually similar to React Router, in that there is no static list of routes; routing is a function call. But it's faster than React on the server, and has better support for HTTP verb support, database I/O, etc. As for there being "better tooling" in modern JS, I'm not sure I agree. Babel and ES6 are impressive, and I love writing the code
Read the rest
they make possible. But I appreciate being able to write Ruby and know that it will just run. Writing packages for node means choosing one of two incompatible module systems, or adding transpiler bloat.
In Happy Birthday, Ruby

Showing the 15 most recent of 26 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.