Slick Extensions

Functional Relational Mapping for Scala

Slick is a Functional Relational Mapping (FRM) library for Scala that makes it easy to work with relational databases.

Functional programmers have long suffered Object-Relational and Object-Math impedance mismatches when connecting to relational databases. Instead of trying to bridge the gap between the object model and the database model, we've brought the database model into Scala so developers don't need to write SQL code or struggle with ORMs. We believe that FRM has emerged as the ideal way to talk to a relational database in the functional programming world.

Slick's FRM integrates databases into Scala, allowing relational data to be queried and processed in the same way as in-memory data using ordinary Scala classes and collections. Slick also provides a single unified interface across all of this—allowing joins across multiple different sources.

This enables full control over when a database access happens and which data is transferred.

  • Work with stored data as if they are normal Scala collections.
  • Retain full control over when a database access happens and which data is transferred.
  • Write your database queries in Scala instead of SQL, thus profiting from the static checking, compile-time safety and compositionality of Scala.

Write database queries in Scala

Because Slick provides a front-end layer that integrates queries transparently using ordinary Scala types, queries can be processed and validated at compile time, even in user-provided database backends. Slick also allows for writing SQL queries, which are executed with an API optimized for Scala instead of using JDBC.

Query and connect with ease

Slick features an extensible query compiler that can generate code for different back-ends. The following database systems are directly supported for type-safe queries (using the query language or Scala code lifted to database queries):

  • Derby/JavaDB
  • H2
  • Microsoft Access
  • MySQL
  • PostgreSQL
  • SQLite
  • DB/2
  • Oracle
  • Microsoft SQL Server

Next steps for commercial database usage

Using the Slick Extensions package is free for evaluation and development. Production use with Oracle, IBM DB2, and Microsoft SQL Server requires a commercial Lightbend Subscription.