Scala Intergrated Query - a database query dsl for scala (note the link to slides)


This package allows to create typesafe queries that get compiled into an efficient set of sql queries. This means that code such as:

(for( n <- nation ) yield {
  val cs =
    for( c <- customer;
      if c.nationkey == n.nationkey
    ) yield c
  (n, cs)


Executes only 2 SQL queries.  Even though there is a nested loop (the code iterates all nations and for each nation finds all customers of that nation)


I like the fusion it creates where on the one hand you work with regular objects and on the other, you don't get n+1 queries.


This is done based on a new effort called virtualized scala ( that allows creating DSLs that don't execute code directly but instead return an expression tree (or AST) that can then be analyzed and optimized. In this case the resulting tree is analyzed to find the optimal queries that will allow to satisfy it (namely, getting all nations and all customers and iterating on the results). Other use cases for scala-virtualized are creating DSLs to work on data structures where the result can be optimized to work in parallel. The scala virtualized effort is backed by a 2.3 euro grant.

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at