Questions tagged [quill.io]

A library that allows you to write queries in Scala with QDSL (Quoted Domain Specific Language). The queries then get executed in the query language of your choice (SQL, CQL, etc.).

Quill provides a Quoted Domain Specific Language (QDSL) to express queries in Scala and execute them in a target language. The library’s core is designed to support multiple target languages, currently featuring specializations for and .

  1. Boilerplate-free mapping. The database schema is mapped using simple case classes.
  2. Quoted DSL. Queries are defined inside a quote block. Quill parses each quoted block of code (quotation) at compile time and translates them to an internal Abstract Syntax Tree (AST)
  3. Compile-time query generation. The Context.run call reads the quotation’s AST and translates it to the target language at compile time, emitting the query string as a compilation message. As the query string is known at compile time, the runtime overhead is very low and similar to using the database driver directly.
  4. Compile-time query validation. If configured, the query is verified against the database at compile time and the compilation fails if it is not valid. The query validation does not alter the database state.

Resources:

41 questions
0
votes
0 answers

How to fix "an expression of type null is ineligible for implicit conversion"

When inspecting this code: def getFilmById(filmId: Long) = quote { query[Film].filter(f => f.film_id == lift(filmId)) } ensime shows an error in place of opening brace: an expression of type Null is ineligible for implicit conversion The…
Andronicus
  • 25,419
  • 17
  • 47
  • 88
0
votes
1 answer

Postgres: use MAX in ON CONFLICT

I have the following table schema: CREATE TABLE table ( pk1 bigint, pk2 bigint, some_text varchar(4), valid_until bigint, PRIMARY KEY (pk1, pk2) I want to insert into this table a record in a way that in case of conflict the final…
simpadjo
  • 3,947
  • 1
  • 13
  • 38
0
votes
2 answers

Organizing Scala implicits associated with a type

I'd like to introduce some types to represent possible values of a field in a larger type. This fields needs to be possible to encode/decode to/from JSON and also be able to be written/read to a database. I'm still new to Scala and the type I would…
beta
  • 2,380
  • 21
  • 38
0
votes
1 answer

Generic Macros with Quill

Hi so I've been trying to create some generic functions using macros and Quill. Here is my implementation of the macro: class Impl(val c: Context) { import c.universe._ def all[T](tblName: Tree, ctx: Tree)(implicit t: WeakTypeTag[T]): Tree = …
Vangogh500
  • 939
  • 1
  • 7
  • 17
0
votes
1 answer

What is the practical maximum number of fields allowed in a Scala case class now that 22 is no longer the limit?

I have a project that is generating a compile-time stack overflow error. I am using Quill for persistence, which uses macros. I have a case class with 600+ fields which represents a database table. During compilation I get the following infinite…
Steve Nester
  • 105
  • 8
0
votes
1 answer

Conflict between Hikari, Quill, and Postgres in the conf file for Play 2.6

I'm getting what seems to be a strange error when I run my Play app (which seems to be the story of my life right now). The other day, I ran into this issue, solved that, was able to run the evolutions and create the tables, and then ran into the…
jmkoni
  • 463
  • 4
  • 14
0
votes
1 answer

Failed to load data source for config using Play-2.6 and Quill.io

I'm currently getting an error when I try to run my Play app. It says Failed to load data source but then it looks like it is indeed loading the data source. I'm very new to Play and Scala and the rest of my team is also new, so apologies if this is…
jmkoni
  • 463
  • 4
  • 14
0
votes
1 answer

quill - can't tokenize a non-scalar lifting

I'm currently getting this error and I can't quite figure out why: exception during macro expansion: java.lang.IllegalStateException: Can't tokenize a non-scalar lifting. AgentService.this.agentsByOrganization(id).id Do I need to convert the Ids to…
jmkoni
  • 463
  • 4
  • 14
0
votes
1 answer

Group by in many-to-many join with Quill

I am trying to achieve with Quill what the following PostgreSQL query does: select books.*, array_agg(authors.name) from books join authors_books on(books.id = authors_books.book_id) join authors on(authors.id = authors_books.author_id) group by…
Daniel Alexandrov
  • 1,299
  • 8
  • 13
0
votes
1 answer

Query in Quill crashing at runtime on syntax error

Relevant snippets: case class Video( id: String, title: String, url: String, pictureUrl: String, publishedAt: Date, channel: String, duration: Option[String], createdOn: Date ) "Connecting" to DB is working, selecting from video…
monnef
  • 3,903
  • 5
  • 30
  • 50
0
votes
1 answer

Scala Quill - queries always dynamic

I am always getting dynamic queries in Quill, even with simplest query I get dynamic query compiler warning log: type DbContext = PostgresAsyncContext[Literal] val db: DbContext = new PostgresAsyncContext(Literal, "db.default") import db._ implicit…
Taras Bilinsky
  • 579
  • 5
  • 10
1 2
3