Akka - Enabling the Cloud to Edge Continuum - Read Blog

Announcing Slick 1.0 - Type-safe Database Queries for Scala

We are excited to announce the release of Slick 1.0 for Scala 2.10, the first major update since 0.11 was released last August. This is an important milestone for us and for the Scala ecosystem, being the first production-ready version of Slick based on a stable Scala release. A lot of work has gone into improving and stabilizing the new features introduced in 0.11, with dozens of bug fixes, greatly improved documentation and deprecation of obsolete APIs.

Slick 1.0 also adds some important new features:

Auto-Generated Keys

Slick has always supported auto-generated primary keys through the use of the O.AutoInc column option:

object A extends Table[(Int, String)]("A") {
  def id = column[Int]("ID", O.PrimaryKey, O.AutoInc)
  def data = column[String]("DATA")
  def * = id ~ data
A.data insertAll ("foo", "bar")

However, when you insert data into such a table, you frequently want to get back the generated key in order to use it immediately to reference the new data. Slick 1.0 now supports this use case with an intuitive syntax:

val ids = A.data returning A.id insertAll ("foo", "bar")

New Drivers

Typesafe provides Slick drivers for Oracle and DB2 databases in the new Slick Extensions package, along with commercial support for Typesafe Subscribers.

Capabilities & TestKit

Database drivers for Slick implement different profiles which expose all supported features, but there are far too many small differences between minor features supported by different database systems to express using profiles. Instead, these features are now described using capability flags defined by the profiles. These provide a more formal specification of a driver's capabilities. The unsupported capabilities are listed in each driver's API documentation and you can check for the availability of a capability at runtime.

In addition to the main Slick artifacts we also publish the Slick TestKit which contains most of Slick's unit tests in a reusable package. It uses the capabilities declared by a driver to find out which tests to run, so you can use it to test your own driver implementations, too. Check out the slick-testkit-example project on GitHub for a demo.


Many other small improvements have gone into Slick 1.0, for example proper support for BLOBs on PostgreSQL, a fully-featured sequence emulation for MySQL, and improved SQL statement logging. You can find more details in the announcement on the Slick website.

By Stefan Zeiger - Slick Tech Lead at Typesafe.

The Total Economic Impact™
Of Lightbend Akka

  • 139% ROI
  • 50% to 75% faster time-to-market
  • 20x increase in developer throughput
  • <6 months Akka pays for itself