Anton Anton - 6 months ago 25
SQL Question

View SQL query in Slick

Is there a way to observe an SQL statement that will be generated by

Query
?

For example, I have this:

val q = actions.filter(v => v.actionHash === hash && v.carriedAt > past)


Can I view its underlying raw SQL?

Answer

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.

Comments