Functional Relational Mapping for Scala
open sourceBSD-2-Clauseself-hostablefree
Slick is a database access library for Scala that lets you query relational databases almost as if you were using Scala collections, with queries that are type-checked at compile time and compose with for comprehensions or combinators. Unlike a classic ORM, it gives you control over when the database is accessed and how much data moves; the schema is an explicit representation that can be code-generated from the real database, and you can drop to plain SQL when needed. Its query compiler generates SQL for PostgreSQL, MySQL, SQL Server, Oracle, DB2, SQLite, H2, HSQLDB and Derby from the same code. The current release is 3.6; Slick 4, in release candidates since June 2026, makes the API asynchronous on Cats Effect 3 with FS2 streaming. BSD-2-Clause licensed.
Problems it solves
- query a relational database from Scala with type-checked, composable queries
- write database queries in Scala that look like collection operations instead of SQL strings
- generate Scala table definitions from an existing database schema
- run the same Scala data access code against PostgreSQL, MySQL or H2 in tests
- stream large query results in a Scala app without loading them all into memory
- use a database library in Scala that fits Cats Effect and FS2
Features
- query API modeled on Scala's collections
- queries checked at compile time
- composable actions, queries and row expressions
- schema code generation from an existing database
- plain SQL queries when needed
- query compiler targeting PostgreSQL, MySQL, SQL Server, Oracle, DB2, SQLite, H2, HSQLDB and Derby
- database metadata introspection API
- Slick TestKit for database plugins
- Slick 4: asynchronous API on Cats Effect 3 and FS2 streams
Capabilities
| Takes plugins | plan not known |
|---|---|
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Slick does.
