Scala’s Slick: A Library For Functional Database Access

by
Tags:
Category:

Download (PDF, 9.27MB)

From the abstract: “This talk presents Slick, Typesafe’s library for accessing databases. Similar in nature to .NET’s LINQ API, Slick is a successor to the popular ScalaQuery library. With Slick, database queries can be expressed using Scala code – which is composable and more convenient than Java APIs like JPA, and safer than string-based query languages like SQL.

With a compile-time check to ensure type-safety, Slick queries allow users to interact with their database without knowing SQL, instead using function calls that fit naturally into their programming model. In this talk we’ll explore some of these functions and the functional programming model used; concepts such as map, flatMap, and group methods – and how we we can use them to query a database like an in-memory collection. If necessary, Slick users can call custom stored procedures and even fall back to raw SQL statements for cases where the Slick API won’t map to a database feature.

Slick currently offers support for many leading Relational Databases, including Microsoft’s SQL Server, MySQL, and PostgreSQL. The Slick team is working on extending support for custom datasources, such as NoSQL datastores like MongoDB.