Questions tagged [slick-3.0]

Slick is a modern database query and access library for Scala by Typesafe.

Slick is a modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can write your database queries in Scala instead of SQL, thus profiting from the static checking, compile-time safety and compositionality of Scala. Slick features an extensible query compiler which can generate code for different backends.

New in Slick 3.0.0-M1

These are the major new features in this miletone:

  • A new API for composing and executing database actions.
  • Improved configuration of database connections via Typesafe Config, including built-in support for HikariCP.
  • Support for nested Option types and non-primtive Option types in the Lifted Embedding.
  • Properly typed outer join operators based on the improved Option support.

Useful Links

488 questions
10
votes
1 answer

How can I omit case class fields in a slick table mapping?

I'm teaching myself some Scala and am currently getting my feet wet with slick (3.1) + play framework, so maybe the answer is simple here and I'm missing something obvious. I have the following model and Table case class User(id: Long = -1, …
user5504273
  • 128
  • 1
  • 6
10
votes
1 answer

Slick join two tables and get result of both

I have a Many to Many relationship setup like this: Person <-> PersonField <-> Field Now I want to query not only all the fields of a Person (I can do that), but a joined version of PersonField with Field of a Person. (I want to query/retrieve the…
user4063815
10
votes
2 answers

How to COUNT(*) in Slick 3.0?

I've been using Slick for quite a while and now I'm migrating from Slick 2.1 to 3.0. Unfortunatelly I got stuck with ordinary stuff like counting lines. My code worked perfectly in Slick 2.1 when I used to do this: connection.withSession { …
10
votes
1 answer

In Slick 3.0, why is the newly-introduced `Streaming` useful?

I found Slick 3.0 introduced a new feature called streaming http://slick.typesafe.com/doc/3.0.0-RC1/database.html#streaming I'm not familiar with Akka. streaming seems a lazy or async value, but it is not very clear for me to understand why it is…
user4622265
10
votes
2 answers

How to configure HikariCP for Slick 3.0.0 RC1 on Typesafe conf

I have a Play Application based on the play-scala Typesafe template (Play Scala Seed), and tried to add Slick 3.0.0 to the project and connect to a PostgreSQL database. First I added the dependencies to build.sbt: libraryDependencies ++= Seq( …
Guillermo Gutiérrez
  • 17,273
  • 17
  • 89
  • 116
9
votes
0 answers

Is possible to avoid declaring StaticDatabaseConfig annotation in every class using tsql in Slick 3.x?

If I want to use compiled time queries in Slick 3.x, I need to declare a StaticDatabaseConfig annotation in every class using tsql. Is there any way to avoid this and set a global…
AlexITC
  • 1,054
  • 1
  • 10
  • 21
9
votes
1 answer

How to use StaticQuery in Slick 3.0.0?

In Slick 2.1 I had the code below to execute an sql-query from a file: def fetchResult[T](sql: String)(implicit getResult: GetResult[T]): List[T] = { val query = Q.queryNA[T](sql) try { Database.forDataSource(DB.getDataSource()) …
sedovav
  • 1,986
  • 1
  • 17
  • 28
9
votes
3 answers

insertOrUpdate with Slick 3

Where in the Slick 3 documentation is it documented on how to do an insertOrUpdate-like operation?
bjfletcher
  • 11,168
  • 4
  • 52
  • 67
8
votes
1 answer

Listen to PostgreSQL NOTIFY events with Slick

Can I use Slick / Play Framework (Scala) to listen to PostgreSQL NOTIFY statements? I want to do something similar to this: http://bjorngylling.com/2011-04-13/postgres-listen-notify-with-node-js.html
glarkou
  • 7,023
  • 12
  • 68
  • 118
8
votes
1 answer

Reduce testing overhead when DAO contains action

For accessing objects, a Slick DAO which contains functions returning actions and objects of a stored type were created. Example: def findByKeysAction(a: String, b: String, c: String = { Users.filter(x => x.a === a && x.b === b && x.c ===…
Th 00 mÄ s
  • 3,776
  • 1
  • 27
  • 46
8
votes
3 answers

Async before and after for creating and dropping scala slick tables in scalatest

I'm trying to figure out a way to have async before and after statements where the next test cases aren't run until the completion of the action inside of the test case. In my case, it is the creating and dropping a table inside of a database val…
Chris Stewart
  • 1,641
  • 2
  • 28
  • 60
8
votes
6 answers

Too many elements for Tuple: 27, allowed: 22

I am new to Slick and using Slick 3.1.1. My table looks like import java.sql.{Blob, Timestamp} import slick.collection.heterogeneous.HNil import slick.driver.MySQLDriver.api._ case class AnomalyC(id: Int, serviceName: String, serviceId: String,…
daydreamer
  • 87,243
  • 191
  • 450
  • 722
8
votes
0 answers

Adding debug points in for-comprehension / partial functions

How can I add debug points to statements in for-comprehension? for { a <- sqlQuery1() b <- sqlQuery2() } yield { // output } I want to inspect as each of the above queries are executed, but simply adding debug points does not seem to work.…
panther
  • 767
  • 5
  • 21
8
votes
1 answer

Slick 3.0: Idiomatic way to GET results from the database inside of Option (Scala Play Framework)

I have this code for an API that allows me to retrieve and object from the database and return a JSON object using Slick 3.0: // Model case class Thing(id: Option[Int], name: String) object Thing { implicit val teamWrites =…
Daniel
  • 4,051
  • 2
  • 28
  • 46
7
votes
1 answer

Do own stuff in Slick transaction

I'm using Slick 3.1.1 and i would like to implement my own stuff on Slick transaction. def findSomeProducts = table.getSomeProducts() //db operation def productTableUpdate = doSomeStuff1() //db operation def priceTableUpdate = doSomeStuff2() //db…
sbb
  • 529
  • 3
  • 25
1
2
3
32 33