All Projects → haskell-beam → Beam

haskell-beam / Beam

A type-safe, non-TH Haskell SQL library and ORM

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Beam

Go Sqlbuilder
A flexible and powerful SQL string builder library plus a zero-config ORM.
Stars: ✭ 539 (+18.72%)
Mutual labels:  sql, orm, postgresql, sqlite
Goqu
SQL builder and query library for golang
Stars: ✭ 984 (+116.74%)
Mutual labels:  sql, postgresql, sqlite, postgres
Sequelize
An easy-to-use and promise-based multi SQL dialects ORM tool for Node.js
Stars: ✭ 25,422 (+5499.56%)
Mutual labels:  sql, orm, postgresql, sqlite
Xorm
Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3,mssql,oracle, Moved to https://gitea.com/xorm/xorm
Stars: ✭ 6,464 (+1323.79%)
Mutual labels:  orm, postgresql, sqlite, postgres
Sqlx
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.
Stars: ✭ 5,039 (+1009.91%)
Mutual labels:  sql, postgresql, sqlite, postgres
Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+3901.76%)
Mutual labels:  orm, postgresql, postgres, sqlite
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+70.7%)
Mutual labels:  sql, orm, postgresql, sqlite
Zeeql3
The ZeeQL (EOF/CoreData/AR like) Database Toolkit for Swift
Stars: ✭ 29 (-93.61%)
Mutual labels:  orm, postgresql, sqlite, postgres
Linq2db
Linq to database provider.
Stars: ✭ 2,211 (+387%)
Mutual labels:  sql, orm, postgresql, sqlite
Electrocrud
Database CRUD Application Built on Electron | MySQL, Postgres, SQLite
Stars: ✭ 1,267 (+179.07%)
Mutual labels:  sql, postgresql, sqlite, postgres
Walkable
A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
Stars: ✭ 384 (-15.42%)
Mutual labels:  sql, orm, postgresql, sqlite
Db
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
Stars: ✭ 2,832 (+523.79%)
Mutual labels:  sql, orm, postgresql, sqlite
Vscode Sqltools
Database management for VSCode
Stars: ✭ 741 (+63.22%)
Mutual labels:  sql, postgresql, sqlite, postgres
Ebean
Ebean ORM
Stars: ✭ 1,172 (+158.15%)
Mutual labels:  sql, orm, sqlite, postgres
Nut
Advanced, Powerful and easy to use ORM for Qt
Stars: ✭ 181 (-60.13%)
Mutual labels:  sql, orm, postgresql, sqlite
Xo
Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server
Stars: ✭ 2,974 (+555.07%)
Mutual labels:  sql, orm, postgresql, sqlite
Node Orm2
Object Relational Mapping
Stars: ✭ 3,063 (+574.67%)
Mutual labels:  orm, postgresql, sqlite
Loukoum
A simple SQL Query Builder
Stars: ✭ 305 (-32.82%)
Mutual labels:  sql, postgresql, postgres
Sqlboiler
Generate a Go ORM tailored to your database schema.
Stars: ✭ 4,497 (+890.53%)
Mutual labels:  orm, postgresql, postgres
Requery
requery - modern SQL based query & persistence for Java / Kotlin / Android
Stars: ✭ 3,071 (+576.43%)
Mutual labels:  sql, sqlite, postgres

Beam: a type-safe, non-TH Haskell relational database library and ORM

Build status

If you use beam commercially, please consider a donation to make this project possible: https://liberapay.com/tathougies

Beam is a Haskell interface to relational databases. Beam uses the Haskell type system to verify that queries are type-safe before sending them to the database server. Queries are written in a straightforward, natural monadic syntax. Combinators are provided for all standard SQL92 features, and a significant subset of SQL99, SQL2003, and SQL2008 features. For your convenience a thorough compatibility matrix is maintained here.

Beam is standards compliant but not naive. We recognize that different database backends provide different guarantees, syntaxes, and advantages. To reflect this, beam maintains a modular design. While the core package provides standard functionality, beam is split up into a variety of backends which provide a means to interface Beam's data query and update DSLs with particular RDBMS backends. Backends can be written and maintained independently of this repository. For example, the beam-mysql and beam-firebird backends are packaged independently.

Recognizing that over-abstraction frequently means caving in to the lowest common denominator, Beam does not do connection or transaction management. Rather, the user is free to perform these functions using the appropriate Haskell interface library for their backend of choice. Additionally, beam backends provide a significant portion of backend-specific functionality which seamlessly fits into the beam ecosystem.

For example, the beam-postgres backend is built off of the postgresql-simple interface library. When using beam-postgres, the user manages connections and transactions with postgresql-simple. The user is free to issue queries directly with postgresql-simple, only using beam when desired. Postgres offers a number of rich data types on top of the standard SQL data types. To reflect this, beam-postgres offers pluggable support for postgres-specific data types and features.

For more information, see the user guide.

For questions, feel free to join our mailing list or head over to #haskell-beam on freenode.

A word on testing

beam-core has in-depth unit tests to test query generation over an idealized ANSI SQL-compliant backend. You may be concerned that there are no tests in either beam-sqlite or beam-postgres. Do not be alarmed. The documentation contains many, many examples of queries written over the sample Chinook database, the schema for which can be found at beam-sqlite/examples/Chinook/Schema.hs. The included mkdocs configuration and custom beam_query python Markdown extension automatically run every query in the documentation against a live database connection. Any errors in serializion/deserialization or invalid syntax are caught while building the documentation. Feel free to open pull-requests with additional examples/tests.

Tests are written

!beam-query
```haskell
!example <template-name> <requirements>
do x <- all_ (customer chinookDb) -- chinookDb available under chinook and chinookdml examples
   pure x
```

The !beam-query declaration indicates this is markdown code block that contains beam query code. The !example declaration indicates that this example should be built against applicable backends and included in the code. The template_name is either chinook or chinookdml (depending on whether you have quest a query or a DML statement). For chinook, the included code should produce a Q query. For chinookdml, the included code should be a monadic action in a MonadBeam. The requirements can be used to select which backends to run this against. See the documentation for examples.

Building the documentation

Beam uses mkdocs for its documentation generation. The included build-docs.sh script can take care of building the documentation and serving it locally. In order to use the tool though, make sure you have a python installation with the mkdocs module installed. You can do this by creating a virtualenv, and pip installing mkdocs, or by using the supplied shell.nix script.

The documentation uses a custom Markdown preprocessor to automatically build examples against the canonical Chinook database. By default, beam will build examples for every beam backend it knows about, including ones not in the main source tree (see docs/beam.yaml for the full configuration). This means you will need to have an instance of all these database servers running and available. This is usually not what you want.

To only build examples for a particular backend, modify mkdocs.yaml and set the enabled_backends configuration setting for the docs.markdown.beam_query preprocessor. For example, to only build docs for beam-sqlite, change

  - docs.markdown.beam_query:
      template_dir: 'docs/beam-templates'
      cache_dir: 'docs/.beam-query-cache'
      conf: 'docs/beam.yaml'
      base_dir: '.'

to

  - docs.markdown.beam_query:
      template_dir: 'docs/beam-templates'
      cache_dir: 'docs/.beam-query-cache'
      conf: 'docs/beam.yaml'
      base_dir: '.'
      enabled_backends:
        - beam-sqlite
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].