I'm trying to use Quill dynamic queries to perform batch insert
In non-dynamic api I would've used:
db.run(quote {
liftQuery(myCollection).foreach(data => querySchema[MyDBClass]("table").insert(data))
})
I've tried doing the same for dynamic query:
db.run({
liftQuery(myCollection).foreach(data => dynamicQuerySchema[MyDBClass](tableNameVar).insertValue(data))
})
But I get the following error:
No implicits found for parameter unquote: DynamicInsert[MyDBClass] => A_
Am I using the API correctly? any help would be appreciated
The work-around is:
val dynamicSchema = context.dynamicQuerySchema[MyDBClass](tableNameVar)
context.transaction {
myCollection.foreach { p =>
context.run(dynamicSchema.insertValue(p))
}
}
For cassandra use without transaction