https://github.com/zio/zio-quill
Compile-time Language Integrated Queries for Scala
https://github.com/zio/zio-quill
cassandra database jdbc linq mysql postgres scala scalajs spark sparksql
Last synced: 3 days ago
JSON representation
Compile-time Language Integrated Queries for Scala
- Host: GitHub
- URL: https://github.com/zio/zio-quill
- Owner: zio
- License: apache-2.0
- Created: 2015-07-20T22:15:04.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-04-19T00:15:29.000Z (11 days ago)
- Last Synced: 2025-04-27T04:16:14.950Z (3 days ago)
- Topics: cassandra, database, jdbc, linq, mysql, postgres, scala, scalajs, spark, sparksql
- Language: Scala
- Homepage: https://zio.dev/zio-quill
- Size: 12.5 MB
- Stars: 2,154
- Watchers: 59
- Forks: 352
- Open Issues: 319
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-scala - Quill ★ 865 ⧗ 0 - Compile-time Language Integrated Query for Scala (Database)
- awesome-github-repos - zio/zio-quill - Compile-time Language Integrated Queries for Scala (Scala)
- awesome-scala - **zio-quill** - time Language Integrated Queries for Scala |   (Table of Contents / Database)
- fucking-awesome-scala - **zio-quill** - time Language Integrated Queries for Scala |   (Table of Contents / Database)
- fucking-awesome-scala - **zio-quill** - time Language Integrated Queries for Scala |   (Table of Contents / Database)
README
[//]: # (This file was autogenerated using `zio-sbt-website` plugin via `sbt generateReadme` command.)
[//]: # (So please do not edit it manually. Instead, change "docs/index.md" file or sbt setting keys)
[//]: # (e.g. "readmeDocumentation" and "readmeSupport".)
![]()
# ZIO Quill
Quill provides a Quoted Domain Specific Language ([QDSL](https://homepages.inf.ed.ac.uk/wadler/papers/qdsl/qdsl.pdf)) to express queries in Scala and execute them in a target language.
[](https://github.com/zio/zio/wiki/Project-Stages)  [](https://oss.sonatype.org/content/repositories/releases/io/getquill/quill-core_2.12/) [](https://oss.sonatype.org/content/repositories/snapshots/io/getquill/quill-core_2.12/) [](https://javadoc.io/doc/io.getquill/zio-quill-docs_2.12) [](https://github.com/zio/zio-quill)
## Introduction
The library's core is designed to support multiple target languages, currently featuring specializations for Structured Query Language ([SQL](https://en.wikipedia.org/wiki/SQL)) and Cassandra Query Language ([CQL](https://cassandra.apache.org/doc/latest/cql/)).
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 `ctx.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.> ### Scala 3 Support
> [ProtoQuill](https://github.com/zio/zio-protoquill) provides Scala 3 support for Quill rebuilding on top of new metaprogramming capabilities from the ground > up! It is published to maven-central as the `quill-_3` line of artifacts.> ### Doobie Support
> See [here](contexts.md#quill-doobie) for Doobie integration instructions.## Example

Note: The GIF example uses Eclipse, which shows compilation messages to the user.
## Documentation
Learn more on the [ZIO Quill homepage](https://zio.dev/zio-quill)!
## Contributing
For the general guidelines, see ZIO [contributor's guide](https://zio.dev/about/contributing).
## Code of Conduct
See the [Code of Conduct](https://zio.dev/about/code-of-conduct)
## Support
Come chat with us on [![Badge-Discord]][Link-Discord].
[Badge-Discord]: https://img.shields.io/discord/629491597070827530?logo=discord "chat on discord"
[Link-Discord]: https://discord.gg/2ccFBr4 "Discord"## Maintainers
- @deusaquilus (lead maintainer)
- @fwbrasil (creator)
- @jilen
- @juliano
- @mentegy
- @mdedetrich### Former maintainers:
- @gustavoamigo
- @godenji
- @lvicentesanchez
- @mxlYou can notify all current maintainers using the handle `@getquill/maintainers`.
## Acknowledgement
The project was created having Philip Wadler's talk ["A practical theory of language-integrated query"](https://www.infoq.com/presentations/theory-language-integrated-query) as its initial inspiration. The development was heavily influenced by the following papers:
* [A Practical Theory of Language-Integrated Query](https://homepages.inf.ed.ac.uk/slindley/papers/practical-theory-of-linq.pdf)
* [Everything old is new again: Quoted Domain Specific Languages](https://homepages.inf.ed.ac.uk/wadler/papers/qdsl/qdsl.pdf)
* [The Flatter, the Better](https://db.inf.uni-tuebingen.de/staticfiles/publications/the-flatter-the-better.pdf)## License
[License](LICENSE)