here is an example test on slick 3.1.x
import slick.jdbc.{SQLActionBuilder, SetParameter, PositionedParameters} object SlickKit { implicit class SQLActionBuilderConcat (a: SQLActionBuilder) { def concat (b: SQLActionBuilder): SQLActionBuilder = { SQLActionBuilder(a.queryParts ++ b.queryParts, new SetParameter[Unit] { def apply(p: Unit, pp: PositionedParameters): Unit = { a.unitPConv.apply(p, pp) b.unitPConv.apply(p, pp) } }) } } }
and then
import SlickKit._ val sql1 = sql""" select count(*) from idinfo_#$i """ val sql2 = sql""" where source=$source """ val sql = sql1 concat sql2 sql.as[Int].head
trydofor
source share