Personal Log of Vicente "Thirdy" S. de Rivera III. Thoughts and opinions about everyday life, Programming, Music etc.
Thursday, August 13, 2015
Print Plain SQL Select Statement in Slick 3.0.0
If you were searching the net on how to print the extremely useful plain SQL select statement when using Slick 3.0.0 queries; Then it's your lucky day.
Here's a working example wherein AccountActivityHistory_00Table is my table.
val q0 = Replica.AccountActivityHistory_00Table.filter(row => (row.DateCreated >= start && row.DateCreated <= end) || (row.DateModified >= start && row.DateModified <= end))
println(q0.result.statements)
It's in the result field, as in result.statements, this is an Iterable of Strings.
As of this writing the example from Typesafe isn't updated yet to slick 3.0.0 release:
https://github.com/typesafehub/activator-hello-slick/blob/slick-3.0/src/main/scala/HelloSlick.scala
And the upgrade guide doesn't tell us anything either:
http://slick.typesafe.com/doc/3.0.0/upgrade.html
Subscribe to:
Posts (Atom)