Selecting many arbitrary columns in Slick Selecting many arbitrary columns in Slick sql sql

Selecting many arbitrary columns in Slick


Slick is not a good fit for your requirements.

The moment you want to access arbitrary columns (for example by using a List[String] of column names), you're losing all the type safety benefits that Slick provides because it cannot validate the schema.

This means you'll have to leave Slick's table classes behind and go for a completely dynamic solution using generated SQL (using String queries).

While Slick does allow you to write SQL manually (take a look at the StaticQuery.query functions), other libraries are better suited for the task. I recommend taking a look at ScalikeJDBC.