A summary of data about the Ruby ecosystem.

https://github.com/sparklemotion/sqlite3-ruby

Ruby bindings for the SQLite3 embedded database
https://github.com/sparklemotion/sqlite3-ruby

Keywords

ruby sqlite

Keywords from Contributors

activerecord rubygems activejob mvc ruby-gem rack xerces sax nokogiri libxslt

Last synced: about 14 hours ago
JSON representation

Repository metadata

Ruby bindings for the SQLite3 embedded database

README.md

Ruby Interface for SQLite3

Overview

This library allows Ruby programs to use the SQLite3 database engine (http://www.sqlite.org).

Note that this module is only compatible with SQLite 3.6.16 or newer.

Test suite

Quick start

For help understanding the SQLite3 Ruby API, please read the FAQ and the full API documentation.

A few key classes whose APIs are often-used are:

  • SQLite3::Database (rdoc)
  • SQLite3::Statement (rdoc)
  • SQLite3::ResultSet (rdoc)

If you have any questions that you feel should be addressed in the FAQ, please send them to the mailing list or open a discussion thread.

require "sqlite3"

# Open a database
db = SQLite3::Database.new "test.db"

# Create a table
rows = db.execute <<-SQL
  create table numbers (
    name varchar(30),
    val int
  );
SQL

# Execute a few inserts
{
  "one" => 1,
  "two" => 2,
}.each do |pair|
  db.execute "insert into numbers values ( ?, ? )", pair
end

# Find a few rows
db.execute( "select * from numbers" ) do |row|
  p row
end
# => ["one", 1]
#    ["two", 2]

# Create another table with multiple columns
db.execute <<-SQL
  create table students (
    name varchar(50),
    email varchar(50),
    grade varchar(5),
    blog varchar(50)
  );
SQL

# Execute inserts with parameter markers
db.execute("INSERT INTO students (name, email, grade, blog)
            VALUES (?, ?, ?, ?)", ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"])

db.execute( "select * from students" ) do |row|
  p row
end
# => ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"]

Thread Safety

When SQLite3.threadsafe? returns true, then SQLite3 has been compiled to
support running in a multithreaded environment. However, this doesn't mean
that all classes in the SQLite3 gem can be considered "thread safe".

When SQLite3.threadsafe? returns true, it is safe to share only
SQLite3::Database instances among threads without providing your own locking
mechanism. For example, the following code is fine because only the database
instance is shared among threads:

require 'sqlite3'

db = SQLite3::Database.new ":memory:"

latch = Queue.new

ts = 10.times.map {
  Thread.new {
    latch.pop
    db.execute "SELECT '#{Thread.current.inspect}'"
  }
}
10.times { latch << nil }

p ts.map(&:value)

Other instances can be shared among threads, but they require that you provide
your own locking for thread safety. For example, SQLite3::Statement objects
(prepared statements) are mutable, so applications must take care to add
appropriate locks to avoid data race conditions when sharing these objects
among threads.

Lets rewrite the above example but use a prepared statement and safely share
the prepared statement among threads:

db = SQLite3::Database.new ":memory:"

# Prepare a statement
stmt = db.prepare "SELECT :inspect"
stmt_lock = Mutex.new

latch = Queue.new

ts = 10.times.map {
  Thread.new {
    latch.pop

    # Add a lock when using the prepared statement.
    # Binding values, and walking over results will mutate the statement, so
    # in order to prevent other threads from "seeing" this thread's data, we
    # must lock when using the statement object
    stmt_lock.synchronize do
      stmt.execute(Thread.current.inspect).to_a
    end
  }
}

10.times { latch << nil }

p ts.map(&:value)

stmt.close

It is generally recommended that if applications want to share a database among
threads, they only share the database instance object. Other objects are
fine to share, but may require manual locking for thread safety.

Fork Safety

Sqlite is not fork
safe

and instructs users to not carry an open writable database connection across a fork(). Using an inherited
connection in the child may corrupt your database, leak memory, or cause other undefined behavior.

To help protect users of this gem from accidental corruption due to this lack of fork safety, the gem will immediately close any open writable databases in the child after a fork. Discarding writable
connections in the child will incur a small one-time memory leak per connection, but that's
preferable to potentially corrupting your database.

Whenever possible, close writable connections in the parent before forking. If absolutely necessary (and you know what you're doing), you may suppress the fork safety warnings by calling SQLite3::ForkSafety.suppress_warnings!.

See ./adr/2024-09-fork-safety.md for more information and context.

Support

Installation or database extensions

If you're having trouble with installation, please first read INSTALLATION.md.

General help requests

You can ask for help or support:

Bug reports

You can file the bug at the github issues page.

Contributing

See CONTRIBUTING.md.

License

This library is licensed under BSD-3-Clause, see LICENSE.

Dependencies

The source code of sqlite is distributed in the "ruby platform" gem. This code is public domain,
see https://www.sqlite.org/copyright.html for details.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 1,213
Total Committers: 88
Avg Commits per committer: 13.784
Development Distribution Score (DDS): 0.701

Commits in past year: 103
Committers in past year: 7
Avg Commits per committer in past year: 14.714
Development Distribution Score (DDS) in past year: 0.456

Name Email Commits
Mike Dalessio m****o@g****m 363
Aaron Patterson a****n@g****m 243
Luis Lavena l****a@g****m 168
dependabot[bot] 4****] 82
Jamis Buck j****s@3****m 66
Stephen Margheim s****m@g****m 49
Rob Holland r****b@i****m 23
Jonathan Metter J****r@g****e 19
NARUSE, Yui n****e@a****p 17
gazayas g****s@h****m 14
Lars Kanis l****s@g****e 13
Jim Flood j****d@t****m 11
Jean Boussier j****r@g****m 8
MSP-Greg G****s@g****m 8
Caleb Albritton w****e@g****m 7
James Berry j****s@j****s 6
Rich Meyers r****s@g****m 5
Alex Watt a****x@a****m 5
Nemo c****s@c****n 4
Peter Goldstein p****n@g****m 4
Nobuyoshi Nakada n****u@r****g 4
Mike Wojciechowski m****w@s****m 4
Jeremy Evans c****e@j****t 3
Robert McLeod r****t@p****z 3
iain barnett h****n@t****m 3
kashif k****f@n****m 3
mishina t****8@g****m 2
Yuki Nishijima m****l@y****t 2
Yasuo Honda y****a@g****m 2
Vipul A M v****d@g****m 2
and 58 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 104
Total pull requests: 428
Average time to close issues: almost 2 years
Average time to close pull requests: about 2 months
Total issue authors: 81
Total pull request authors: 40
Average comments per issue: 3.29
Average comments per pull request: 0.98
Merged pull request: 344
Bot issues: 0
Bot pull requests: 121

Past year issues: 4
Past year pull requests: 68
Past year average time to close issues: 10 days
Past year average time to close pull requests: 11 days
Past year issue authors: 4
Past year pull request authors: 10
Past year average comments per issue: 1.75
Past year average comments per pull request: 0.44
Past year merged pull request: 49
Past year bot issues: 0
Past year bot pull requests: 42

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/sparklemotion/sqlite3-ruby

Top Issue Authors

  • flavorjones (10)
  • forthrin (3)
  • tenderlove (3)
  • audibleblink (2)
  • fractaledmind (2)
  • rongcuid (2)
  • caponecicero (2)
  • voxik (2)
  • penguinpowernz (2)
  • rickhull (2)
  • penberg (2)
  • jirislaby (2)
  • collimarco (2)
  • erdemgezer (1)
  • walterdavis (1)

Top Pull Request Authors

  • flavorjones (193)
  • dependabot[bot] (121)
  • tenderlove (37)
  • fractaledmind (15)
  • alexcwatt (8)
  • casperisfine (4)
  • masamitsu-murase (3)
  • MSP-Greg (3)
  • pawurb (2)
  • wjlroe (2)
  • haileys (2)
  • stevecj (2)
  • miyucy (2)
  • byroot (2)
  • Maaarcocr (2)

Top Issue Labels

  • feature (9)
  • installation (6)
  • performance (2)
  • needs-more-info (2)
  • bug (2)
  • platform/windows (1)
  • help-wanted (1)
  • upstream (1)

Top Pull Request Labels

  • dependencies (120)
  • ruby (90)
  • github_actions (30)
  • blocked (2)
  • bug (1)
  • feature (1)
  • performance (1)

Package metadata

gem.coop: sqlite3

Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org). Precompiled binaries are available for common platforms for recent versions of Ruby.

guix: ruby-sqlite3

Interface with SQLite3 databases

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/ruby-xyz.scm#n10434
  • Licenses: bsd-3
  • Latest release: 2.5.0 (published 6 months ago)
  • Last Synced: 2026-04-27T16:16:35.093Z (4 months ago)
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.146%
    • Stargazers count: 0.267%
    • Forks count: 0.318%
ubuntu-22.04: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 1.4.2-4 (published 6 months ago)
  • Last Synced: 2026-03-13T23:40:22.632Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.245%
    • Forks count: 0.397%
    • Stargazers count: 0.583%
ubuntu-24.10: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 1.6.9-1build1 (published 6 months ago)
  • Last Synced: 2026-03-13T17:13:10.986Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.291%
    • Forks count: 0.434%
    • Stargazers count: 0.728%
rubygems.org: sqlite3

Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org). Precompiled binaries are available for common platforms for recent versions of Ruby.

proxy.golang.org: github.com/sparklemotion/sqlite3-ruby

gem.coop: sqlite3-full

This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org). You must have the SQLite engine installed in order to build this module.

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: http://www.rubydoc.info/gems/sqlite3-full/
  • Licenses: BSD-3
  • Latest release: 1.3.9.3 (published over 11 years ago)
  • Last Synced: 2026-08-15T02:01:08.015Z (1 day ago)
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 10,748 Total
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 15.673%
    • Downloads: 47.018%
  • Maintainers (1)
rubygems.org: openaustralia-sqlite3

This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org). You must have the SQLite engine installed in order to build this module. Note that this module is only compatible with SQLite 3.6.16 or newer.

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: http://www.rubydoc.info/gems/openaustralia-sqlite3/
  • Licenses: BSD-3
  • Latest release: 1.0.0 (published over 12 years ago)
  • Last Synced: 2026-08-15T02:01:07.591Z (1 day ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 6,366 Total
  • Rankings:
    • Forks count: 1.91%
    • Stargazers count: 2.168%
    • Dependent repos count: 15.44%
    • Dependent packages count: 15.783%
    • Average: 19.731%
    • Downloads: 63.355%
  • Maintainers (2)
gem.coop: openaustralia-sqlite3

This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org). You must have the SQLite engine installed in order to build this module. Note that this module is only compatible with SQLite 3.6.16 or newer.

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: http://www.rubydoc.info/gems/openaustralia-sqlite3/
  • Licenses: BSD-3
  • Latest release: 1.0.0 (published over 12 years ago)
  • Last Synced: 2026-08-15T02:01:07.502Z (1 day ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,366 Total
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 21.283%
    • Downloads: 63.848%
  • Maintainers (2)
rubygems.org: sqlite3-full

This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org). You must have the SQLite engine installed in order to build this module.

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: http://www.rubydoc.info/gems/sqlite3-full/
  • Licenses: BSD-3
  • Latest release: 1.3.9.3 (published over 11 years ago)
  • Last Synced: 2026-08-15T02:01:07.764Z (1 day ago)
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 10,748 Total
  • Rankings:
    • Forks count: 1.764%
    • Stargazers count: 2.009%
    • Dependent packages count: 15.706%
    • Average: 22.903%
    • Dependent repos count: 46.782%
    • Downloads: 48.253%
  • Maintainers (1)
debian-11: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: https://packages.debian.org/bullseye/ruby-sqlite3
  • Licenses: bsd-3-clause
  • Latest release: 1.4.2-3 (published 6 months ago)
  • Last Synced: 2026-03-14T04:21:27.694Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.04: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 1.4.2-4build2 (published 6 months ago)
  • Last Synced: 2026-03-12T01:17:15.649Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
openbsd-7.9-amd64: databases/ruby-sqlite3,ruby40

access a SQLite3 database from ruby

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 2.7.3 (published 4 months ago)
  • Last Synced: 2026-05-28T00:39:58.313Z (3 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
  • Maintainers (1)
gentoo-portage: dev-ruby/sqlite3

An extension library to access a SQLite database from Ruby

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: https://packages.gentoo.org/packages/dev-ruby/sqlite3
  • Licenses: BSD
  • Latest release: 2.9.0 (published 4 months ago)
  • Last Synced: 2026-07-29T01:17:19.910Z (19 days ago)
  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-12: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: https://packages.debian.org/bookworm/ruby-sqlite3
  • Licenses: bsd-3-clause
  • Latest release: 1.4.2-4 (published 6 months ago)
  • Last Synced: 2026-03-13T23:47:14.710Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
openbsd-7.9-amd64: databases/ruby-sqlite3,ruby33

access a SQLite3 database from ruby

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 2.7.3 (published 4 months ago)
  • Last Synced: 2026-05-28T00:39:57.087Z (3 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
  • Maintainers (1)
ubuntu-24.04: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 1.4.2-4build4 (published 6 months ago)
  • Last Synced: 2026-03-06T16:42:36.487Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-20.04: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 1.4.2-2build1 (published 6 months ago)
  • Last Synced: 2026-03-13T14:25:28.949Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-10: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: https://packages.debian.org/buster/ruby-sqlite3
  • Licenses: bsd-3-clause
  • Latest release: 1.3.13-1 (published 6 months ago)
  • Last Synced: 2026-03-13T19:07:55.388Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-13: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Documentation: https://packages.debian.org/trixie/ruby-sqlite3
  • Licenses: bsd-3-clause
  • Latest release: 1.7.3-1 (published 6 months ago)
  • Last Synced: 2026-03-14T18:08:41.769Z (5 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
openbsd-7.9-amd64: databases/ruby-sqlite3,ruby34

access a SQLite3 database from ruby

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 2.7.3 (published 4 months ago)
  • Last Synced: 2026-05-28T00:39:57.680Z (3 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
  • Maintainers (1)
ubuntu-23.10: ruby-sqlite3

  • Homepage: https://github.com/sparklemotion/sqlite3-ruby
  • Licenses: bsd-3-clause
  • Latest release: 1.4.2-4build2 (published 6 months ago)
  • Last Synced: 2026-07-22T20:42:50.625Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%

Dependencies

Gemfile rubygems
  • hoe-bundler ~> 1.0 development
  • hoe-gemspec ~> 1.0 development
  • mini_portile2 ~> 2.0 development
  • minitest ~> 5.11 development
  • rake-compiler ~> 1.0 development
  • rake-compiler-dock ~> 0.6.0 development
  • rdoc >= 4.0, < 6 development
.github/workflows/upstream.yml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite
sqlite3.gemspec rubygems
  • minitest ~> 5.15 development
  • psych ~> 4.0 development
  • rake-compiler ~> 1.2.0 development
  • rake-compiler-dock ~> 1.2.1 development
  • rdoc >= 4.0, < 7 development
  • mini_portile2 ~> 2.8.0
.github/workflows/ci.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/upload-artifact v3 composite
  • ruby/setup-ruby v1 composite
  • ruby/setup-ruby-pkgs v1 composite
.github/workflows/downstream.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • ruby/setup-ruby-pkgs v1 composite
.github/workflows/rdoc.yml actions
  • actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
  • actions/configure-pages 45bfe0192ca1faeb007ade9deae92b16b8254a0d composite
  • actions/deploy-pages cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 composite
  • actions/upload-pages-artifact fc324d3547104276b827a68afc52ff2a11cc49c9 composite
  • ruby/setup-ruby 95ef2b042f9d7a56d8268cba8559e2842e2ad01b composite
.github/workflows/build-gems.yml actions
  • actions/cache 55cc8345863c7cc4c66a329aec7e433d2d1c52a9 composite
  • actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
  • actions/upload-artifact 043fb46d1a93c77aae656e7c1c64a875d1fc6a0a composite
  • ruby/setup-ruby 95ef2b042f9d7a56d8268cba8559e2842e2ad01b composite
.github/workflows/release.yml actions
  • actions/download-artifact 3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c composite
  • rubygems/configure-rubygems-credentials dc5a8d8553e6ee01fc26761a49e99e733d17954a composite

Score: 32.480234803444255