zio / zio-quill

Compile-time Language Integrated Queries for Scala

Home Page:https://zio.dev/zio-quill

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Found more then one type of Query" Warning

dave-pollock opened this issue · comments

Version: 4.6.1
Module: quill-cassandra
Database: cassandra

I'm trying to use Cassandra's batch statements and I'm getting a warning logged, for example:

[WARN] Found more then one type of Query: Queue(Insert, Insert, Insert, Insert). Using 1st one!

which comes from here.

I build the batch statement using this buildBatch method:

  private def buildBatch[T, U, V, W]: Quoted[(Insert[T], Insert[U], Insert[V], Insert[W]) => Insert[(T, U, V, W)]] =
    quote {
      (insertT: Insert[T], insertU: Insert[U], insertV: Insert[V], insertW: Insert[W]) =>
        sql"BEGIN BATCH $insertT; $insertU; $insertV; $insertW; APPLY BATCH;".as[Insert[(T, U, V, W)]]
    }

And then run it like so:

  db.run {
    buildBatch[MyCaseClass1, MyCaseClass2, MyCaseClass3, MyCaseClass4](
      query[MyCaseClass1].insertValue(liftCaseClass(obj1)),
      query[MyCaseClass2].insertValue(liftCaseClass(obj2)),
      query[MyCaseClass3].insertValue(liftCaseClass(obj3)),
      query[MyCaseClass4].insertValue(liftCaseClass(obj4))
    )
  }

This appears to work fine. The batch statement is executed properly, however the warning message is always logged to stdout.

Two parts to the question:

A) Is this a good approach, or is there a better way to run Cassandra batch statements?

B) Assuming this approach is fine, can we replace the println used in the discoverFromAst method with a standard logging framework so that it can be configured to be hidden? It's appearing constantly in my logs and confusing people.

Thanks!

@getquill/maintainers