Channels

Services

Slick 1.0 simplifies database access with Scala

Slick, a database access library for the Scala language designed by Typesafe, has reached its 1.0 release milestone. Slick allows developers to write their database queries in Scala instead of a database native language like SQL, reaping the benefits of static checking and compile time safety afforded by the library's query compiler. The tool can be extended to interface with several different database backends and allows developers to access the data stored in it as if they were directly using Scala collections. For example, creating a table would look like:

With Slick 1.0, the developers are delivering the first major update to the library since it was introduced in August 2012. The new version introduces improvements such as the ability to immediately retrieve automatically generated primary keys:

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

Supported databases include MySQL, SQLite, PostgreSQL, Microsoft's SQL Server and Access. Slick 1.0 also includes new connectors for Oracle and DB2 databases as part of the commercially licensed Slick Extensions provided by Typesafe. A full list is available as part of the library's online documentation.

Another new feature is Slick TestKit which contains most of the package's unit tests in a reusable form and allows users to test existing database drivers or drivers that the users have written themselves. The implementation of capability flags allows developers to compensate for minor differences in the abilities of different database implementations. Other improvements are listed in the official release announcement.

Slick 1.0 is available for Scala 2.10.0 from the project's web site. The library's source code is available under a BSD licence from GitHub.