Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 22 15:09
    rpiotrow commented #2040
  • Jan 21 19:47
    otrebski commented #2061
  • Jan 20 21:42
    lolgab edited #2067
  • Jan 20 19:52
    lolgab opened #2067
  • Jan 20 16:57
    qubits4all starred getquill/quill
  • Jan 20 08:48
    romanovsky starred getquill/quill
  • Jan 19 21:48
    mgibowski synchronize #2041
  • Jan 18 15:11
    giovannimorlin starred getquill/quill
  • Jan 18 11:17
    JNKHunter starred getquill/quill
  • Jan 17 13:23
    scala-steward opened #2066
  • Jan 17 13:23
    scala-steward closed #2038
  • Jan 17 13:23
    scala-steward commented #2038
  • Jan 17 13:23
    scala-steward opened #2065
  • Jan 16 01:11
    kubukoz opened #2064
  • Jan 15 06:31
    dnim starred getquill/quill
  • Jan 15 00:11
    ks228 starred getquill/quill
  • Jan 14 10:40
    andreami starred getquill/quill
  • Jan 14 05:27
    sqrtqiezi starred getquill/quill
  • Jan 14 01:12
    kumar-ish starred getquill/quill
  • Jan 12 10:30
    Matzz commented #2043
nafg
@nafg
(3) Since field names are usually significant, should the name of the field of the embedded case class just be ignored? That feels inconsistent. (As in, class class Outer(field1: Int, ignoredName: SomeEmbeddedCaseClass))
If the only issue was (2), you could argue that the default should be to nest (flatten), and the presence of a typeclass allows Quill to encode it as a single field
nafg
@nafg
Point (1) suggests that the behavior might be backend-dependent, but that might not be desired. Not sure.
Point (3) is not the biggest deal, but I could hear an argument that the column names might in some cases make sense to be a combination of the outer field name and the inner field name
For example given case class Person(name: String) and case class Row(owner: Person) the field name would be owner_name
But in other cases that's not desirable
Again, if for such cases I don't have to rely on Quill guessing a bunch of stuff based on my field names, but I could have more explicit building blocks, like a first-class Column type, that I could build my own abstractions on top of (as I do in Slick), it would enable a lot of possibilities
Then by default Quill generates those Columns based on a class class' field names and types (and implicits for those types), but you could override that behavior
vonchav
@voonchav_gitlab

Hi all,
I'm trying to refactor the following dynamic query into a compile-time version:

      val query = if (fetchingForward)
        quote {
          filterBy(criteria).sortBy(_.id)(Ord.desc)
        }
      else
        quote {
          filterBy(criteria).sortBy(_.id)(Ord.asc)
        }

I was trying the following:

    val sortOrder: Ord[Int] = if (fetchingForward) Ord.desc else Ord.asc

    val query = quote {
      filterBy(criteria).sortBy(_.id)(lift(sortOrder))
    }

However, I'm getting the exception during macro expansion error. Any suggestion on how I can fix this? Cheers.

2 replies
Swoorup Joshi
@Swoorup
does quill support scala 3?
1 reply
Yannick
@fishb6nes
Is it possible to override how quill decodes and encodes LocalDateTime fields? I have a custom implicit MappedEncoding imported but it appears to be ignored (as it would be mapping to an ISO string but is still mapped to what looks like an epoch second in stead). Is there any extra configuration to override the dencoders for those types that Quill is already aware of?
Jack Henahan
@jhenahan
Are there docs or a guide for writing and using a custom dialect with Quill? I interact with Vertica at work a lot, and having a nicer way to write queries than throwing strings at their JDBC would be magic
(Obviously I'd be happy to PR it back upstream if I get it working)
Dan Di Spaltro
@dispalt
@fishb6nes an approach is to make a newtype like https://github.com/estatico/scala-newtype or shapeless tagged type, and do the mappedEncoding with that type.
Yannick
@fishb6nes
Aah thank you @dispalt tagged types look interesting, I should probably use those in more places
dweeb azoid
@shnerk_twitter
I am trying to filter a Union of 2 results by a value from a separate quote, is that possible?
val date = quote{query[Object].map(d=>d.DateTimeP)}
sven42
@sven42

Hello,

what is the current recommendation about what async context to use with Quill 3.6.0 for PostgreSQL and with Scala 2.13?
There are some alternatives, but

  • quill-async-postgres seems to be discontinued and buggy,
  • quill-jasync-postgres seems not to be the official replacement and
  • quill-ndbc-postgres is still not released for 2.13 (#1727)
Alexander Ioffe
@deusaquilus
@sven42 I think quill-jasync-postgres is the official replacement.
I would like to deprecate Quill Scala 2.11 Javascript. All JVM 2.11 modules will remain for now. Does anyone have critical use-cases for this library?
sven42
@sven42
Thank you very much @deusaquilus
Yisrael Union
@yisraelU
is there any documentation\videos that i can consume that will help me understand the internals of quill ?
Alexander Ioffe
@deusaquilus
@yisraelU Check out this series. I go through implementing a mini-quill in Scala 3. This goes faily deep into Parsing and Quotation. Doesn’t cover lifts and encoders/decoders though.
1 reply
nafg
@nafg
@deusaquilus hi, any thoughts on my points above?
Yisrael Union
@yisraelU

is there any way to reuse querySchema definitions. for example

case class Person(name: String, age: Int) extends Embedded
case class Unit(stuff:Int,person:Person)
val q = quote{querySchema[Person]("table",
                                 _.name-> "NAMED",_.age->"MyAge")}
val m = ctx.run(query[Unit].filter(p => p.person.name == "John"))

I would like to be able to use the schema defined for Person in the query defined for Unit either through implicits or combining 2 querySchemas

Oleg Pyzhcov
@oleg-py
Hey guys, what's the proper way to do update ... returning that typechecks to a list of results? I'm using quill-jdbc-monix 3.6.0 with postgres
priyankadhiman0803
@priyankadhiman0803

Table case class is

case class DailyOrgActivity(
    orgId: UUID,
    date: String,
    nuggetId: UUID,
    userId: String)

want to filter between startTime and endTime which are both org.joda.time.Datetime
how to do that in easy and effectibve way.
Right now I am getting a List(string ) between these two dates and using
.filter(activity => liftQuery(inDatesChunk).contains(activity.date))
but it is not a good way.

2 replies
Aditya Prasad
@monktastic
Hi! If I have a field in my domain object that is itself a case class with a few fields, how do I tell Quill to store them as separate fields in the db?
Aditya Prasad
@monktastic
Aditya Prasad
@monktastic
What about if I want to store the case class as a single field using custom serialization/deserialization logic?
1 reply
dwlizlo
@dwlizlo
@deusaquilus as for the quill and doobie integration. When it comes to data selection support only ConnectionIO[List[]] or there is a way to get ConnectionIO[Option[]] / ConnectionIO[_]?
dwlizlo
@dwlizlo
I kinda answered it myself. Quill in general returns only list of results as SQL databases in general return flat list of values (0..n)
Ashutosh
@ashutosh-shirole
Hi! Is it possible to use this library with Java 8/11 instead of scala? If yes, where can I find some examples?
Lorenzo Gabriele
@lolgab
@ashutosh-shirole Directly in Java I don't think so because it is based on macros that are ran by the Scala Compiler at compile time. You could instead write a java interface with all the methods you need, returning java types and collections, and implement this interface in Scala using Quill. This should be possible.
Ashutosh
@ashutosh-shirole
@lolgab Thats what I thought too. Thanks for the answer. :+1:
Michał Gibowski
@mgibowski
Hi, there is a small PR of mine waiting for a review. It fixes an annoyance for MySQL users that have tables with many columns. Maybe it's not a very common problem, however as the changes are small, it would be awesome if it could get reviewed. Just updated the branch to the master. PR: getquill/quill#2041 Related issue: getquill/quill#1907
Lorenzo Gabriele
@lolgab

Hi everyone :-)
Noticed right now that quill is sensitive to the order or parameters, constructing a case class via apply method in a quote {} block and using named parameters.
If I change the order of the parameters the code doesn't compile anymore giving:

Found the following free variables: IdentName(x2), IdentName(x1), IdentName(x5), IdentName(x3), IdentName(x6), IdentName(x4), IdentName(x7).
Quotations can't reference values outside their scope directly.
In order to bind runtime values to a quotation, please use the method `lift`.
Example: `def byName(n: String) = quote(query[Person].filter(_.name == lift(n)))`

      .run(quote {

Is it a known problem?

Yisrael Union
@yisraelU
@lolgab can you post code
Lorenzo Gabriele
@lolgab
@yisraelU Trying to find a reproduction
Lorenzo Gabriele
@lolgab

Take this ammonite script:

import $ivy.`io.getquill::quill-sql:3.6.0`
import io.getquill._
case class Foo(
  a: Int,
  b: String
)
case class Bar(
  a: Int,
  b: String
)
val ctx = new SqlMirrorContext(MirrorSqlDialect, SnakeCase)
import ctx._
ctx.run(quote {
  for {
    foo <- query[Foo]
  } yield Bar(b = foo.b, a = foo.a)
})

If you change Bar(b = foo.b, a = foo.a) with Bar(a = foo.a, b = foo.b) it works!

I'm opening a bug on the issues tracker
Yisrael Union
@yisraelU
interesting if you call translate on the quote instead of run you can see how its interpreting it
the one that throws an error is returning
querySchema("Foo").map(foo => CaseClass(a: x2, b: x1))
its not using foo at all
Lorenzo Gabriele
@lolgab
I opened an issue here: getquill/quill#2067
Yisrael Union
@yisraelU
I have a typical scenario , a case class that i want to use for both read and write schema. It includes the PK which is autogenerated .
Until now I have been populating the object with a fake PK (i.e. out of range like a negative) in order to perform an insert and using the InsertMeta to exclude the id from being inserted.
Is there a better way to do this ?
Only other idea I have is have a 2 separate classes, reads would include the insert data plus an ID
e-Evolution
@e-Evolution
Does anyone know if quill works with scala 3 and ZIO? can I testing the some beta version https://www.youtube.com/watch?v=SmBpGkIsJIU?