View SQL query in Slick

Slick 2.X:

You can print the query statement as shown on the Slick documentation:

val invoker = q.invoker
val statement = q.selectStatement

For other type of statements look at insertStatement, deleteStatement and updateStatement.

Slick 3.X:

val res = table.filter(_.id === 1L).result
res.statements.foreach(println)

Docs.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)