Typesafe Reactive Platform

Slick

Slick is a Functional Relational Mapping library for Scala that makes it easy to work with relational databases. It integrates databases into Scala, allowing stored and remote data to be queried and processed in the same way as in-memory data using ordinary Scala classes and collections. This enables full control over when a database access happens and which data is transferred.

Key features of the Slick database connector include:

  • 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.

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
  • HSQLDB/HyperSQL
  • Microsoft Access
  • MySQL
  • PostgreSQL
  • SQLite
  • DB/2
  • Oracle
  • Microsoft SQL Server

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 back-ends. Using Slick, programmers can directly write database queries in Scala, benefitting from the static checking, compile-time safety and compositionality of Scala. Slick also allows for writing SQL queries and executing them with an API optimized for Scala instead of using JDBC.

Licensing

Development with Slick is free for all databases, however using DB/2, Oracle or Microsoft SQL Server in a production application requires the purchase of a Typesafe Subscription.