Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Found more then one type of Query" Warning #2843

Open
dave-pollock opened this issue Sep 12, 2023 · 0 comments
Open

"Found more then one type of Query" Warning #2843

dave-pollock opened this issue Sep 12, 2023 · 0 comments

Comments

@dave-pollock
Copy link

dave-pollock commented Sep 12, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant