beam-sqlite: Beam driver for SQLite

[ database, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

Beam driver for the SQLite embedded database. See here for more information


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
werror

Enable -Werror during development

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.2.0.0, 0.3.0.0, 0.3.1.0, 0.3.2.0, 0.3.2.1, 0.3.2.2, 0.3.2.3, 0.3.2.4, 0.4.0.0, 0.5.0.0, 0.5.1.0, 0.5.1.1, 0.5.1.2, 0.5.2.0, 0.5.3.0, 0.5.4.0, 0.5.4.1, 0.5.5.0, 0.5.6.0, 0.5.7.0, 0.6.0.0, 0.7.0.0 (info)
Change log ChangeLog.md
Dependencies aeson (>=0.11 && <2.3), attoparsec (>=0.13 && <0.15), base (>=4.11 && <5), beam-core (>=0.11 && <0.12), beam-migrate (>=0.6 && <0.7), bytestring (>=0.10 && <0.13), containers (>=0.6 && <0.9), direct-sqlite (>=2.3.27), dlist (>=0.8 && <1.1), free (>=4.12 && <5.3), hashable (>=1.2 && <1.6), monad-control (>=1.0 && <1.1), mtl (>=2.1 && <2.4), network-uri (>=2.6 && <2.7), scientific (>=0.3 && <0.4), sqlite-simple (>=0.4 && <0.5), text (>=1.0 && <2.2), time (>=1.6 && <1.15), transformers-base (>=0.4 && <0.5) [details]
License MIT
Copyright (C) 2017-2018 Travis Athougies
Author Travis Athougies
Maintainer travis@athougies.net
Uploaded by LaurentRDC at 2026-04-28T14:37:17Z
Category Database
Home page https://haskell-beam.github.io/beam/user-guide/backends/beam-sqlite/
Bug tracker https://github.com/haskell-beam/beam/issues
Source repo head: git clone https://github.com/haskell-beam/beam.git(beam-sqlite)
Distributions LTSHaskell:0.5.6.0, Stackage:0.5.6.0
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 11484 total (80 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-04-28 [all 1 reports]

Readme for beam-sqlite-0.7.0.0

[back to package description]

beam-sqlite: Beam backend for the SQLite embedded database

beam-sqlite is a beam backend for the SQLite embedded database.

SQLite is mostly standards compliant, but there are a few cases that beam-sqlite cannot handle. These cases may result in run-time errors. For more information, see the documentation. Due to SQLite's embedded nature, there are currently no plans to get rid of these. However, proposals and PRs to fix these corner cases are welcome, where appropriate.

Migration support

beam-sqlite supports schema introspection and verification via Database.Beam.Sqlite.Migrate, including:

  • Tables, columns, and their types,
  • NOT NULL constraints,
  • Primary keys,
  • User-created secondary indices (via PRAGMA index_list / PRAGMA index_info),
  • Foreign key constraints (via PRAGMA foreign_key_list), including ON DELETE / ON UPDATE actions.

Declaring foreign keys

Use addTableForeignKey from beam-migrate to declare a foreign key on a checked table entity:

let db = defaultMigratableDbSettings `withDbModification`
          (dbModification @_ @Sqlite)
            { _orders =
                addTableForeignKey (_customers db)
                  (\t -> selectorColumnName _order_customer_id t NE.:| [])
                  primaryKeyColumns
                  ForeignKeyNoAction      -- ON UPDATE NO ACTION (default)
                  ForeignKeyActionCascade -- ON DELETE CASCADE
            }

Note: SQLite disables foreign key enforcement by default. Issue PRAGMA foreign_keys = ON on each connection (or set it in your open hook) to enable it at runtime.