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))

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:

And the upgrade guide doesn't tell us anything either:

1 comment:

Anonymous said...

Hi Thirdy,

Good day!

Pardon for my unsolicited message and hope this finds you well.

We came across your profile in LinkedIn and we were impressed with your experience and thought it may be worth reaching out. Our client is currently in need for a Scala Developer. Here attached is the Job Description of the position and Company Profile of my client. If you are interested, kindly send back your updated CV then just inform me if when is the best time to give you a call.

Hope to hear from you soon!

Best Regards,

Selma Guatlo
Recruitment Specialist
19th floor, 139 Corporate Center, Valero Makati City
T: 63 (917) 845 9904