DEV.co
Open-Source Databases · zio

zio-quill

ZIO Quill is a Scala library that lets you write database queries as compile-time-safe code blocks, translating them to SQL or CQL at build time rather than runtime. It eliminates boilerplate schema mapping and provides early error detection by validating queries against the database during compilation.

Source: GitHub — github.com/zio/zio-quill
2.2k
GitHub stars
352
Forks
Scala
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryzio/zio-quill
Ownerzio
Primary languageScala
LicenseApache-2.0 — OSI-approved
Stars2.2k
Forks352
Open issues358
Latest releasev4.8.6 (2025-07-17)
Last updated2026-07-07
Sourcehttps://github.com/zio/zio-quill

What zio-quill is

Quill implements a Quoted Domain Specific Language (QDSL) that parses Scala code quotations at compile time into an Abstract Syntax Tree (AST), then generates optimized SQL/CQL strings with zero runtime overhead. It supports JDBC, Cassandra, Spark SQL, PostgreSQL, MySQL, and ScalaJS targets, with Scala 3 support via ProtoQuill.

Quickstart

Get the zio-quill source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/zio/zio-quill.gitcd zio-quill# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Type-safe Scala application queries

Build queries in Scala with compile-time validation. Catch SQL errors before deployment and reduce runtime query generation overhead.

Multi-database compatibility layers

Write once, deploy to PostgreSQL, MySQL, or Cassandra with the same Scala code. Quill translates to the target dialect at compile time.

Data-heavy Spark analytics pipelines

Leverage Spark SQL specialization for ETL workflows where queries are known at build time and must be optimized for distributed execution.

Implementation considerations

  • Compile-time validation requires database schema availability at build time; configure contexts carefully to avoid build-time performance penalties.
  • Case class schema mapping must be kept in sync with actual database schemas; no automatic schema versioning or migration tooling built in.
  • Quoted block syntax and macro expansion can produce cryptic compile errors; invest time in error interpretation and IDE support (Eclipse, IntelliJ).
  • Scala 2 vs. Scala 3 support split between Quill and ProtoQuill; verify which version your project targets before adoption.
  • Performance overhead is minimal at runtime, but compile-time AST generation and optional validation can increase build time on large query-heavy projects.

When to avoid it — and what to weigh

  • Ad-hoc or dynamic query construction — Quill requires queries to be known at compile time. If you need to build queries dynamically at runtime, use a traditional ORM or query builder instead.
  • Rapid prototyping or proof-of-concept work — Compile-time validation and quote block syntax add friction during exploration. Consider lightweight query builders for early-stage prototypes.
  • Team unfamiliar with Scala or functional programming — Quill's compile-time metaprogramming and Scala-specific syntax have a steep learning curve. Requires strong Scala expertise to debug and extend.
  • Non-JVM or non-Scala ecosystems — Quill is Scala-only. If your stack uses Python, Node.js, or Go, you cannot use it; choose language-native ORM or query libraries instead.

License & commercial use

Licensed under Apache License 2.0 (SPDX: Apache-2.0), a permissive OSI-approved license allowing commercial use, modification, and distribution with standard liability disclaimers.

Apache-2.0 permits commercial use without license fees or restrictions. You may use Quill in proprietary applications, modify it, and distribute compiled binaries. No special commercial license needed. However, verify your legal team's comfort with Apache 2.0 attribution requirements in production environments.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Compile-time query generation eliminates most SQL injection risks by design (queries are static, not user-constructed). No sensitive data handling, encryption, or audit logging apparent from code excerpt. Depends on JDBC/Cassandra driver security posture for network and credential handling. Review driver versions and TLS configuration for production deployments. No security policy or incident response process mentioned.

Alternatives to consider

Doobie

Lightweight Scala query library with similar compile-time safety but simpler syntax and narrower scope; good if you want less metaprogramming complexity and more manual control.

Slick

Another Scala query DSL with strong type-safety and lazy evaluation model; mature but larger footprint and different API philosophy; consider if team prefers reactive/streaming abstractions.

JPA/Hibernate

Traditional ORM for JVM polyglot teams; supports dynamic queries and schema generation but with higher runtime overhead and less type safety than Quill.

Software development agency

Build on zio-quill with DEV.co software developers

Our engineers can help you architect compile-time query systems or migrate existing Scala applications to Quill. Contact us to discuss your specific database and performance requirements.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

zio-quill FAQ

Does Quill require a database connection at compile time?
Only if you enable compile-time query validation. Query generation works offline; validation is optional and can be disabled for CI/CD environments that lack database access.
Can I use Quill with Scala 3?
Yes, via ProtoQuill (published as `quill-<module>_3` artifacts). ProtoQuill rebuilds Quill using Scala 3 metaprogramming and is the official Scala 3 path.
What databases does Quill support?
SQL dialects (PostgreSQL, MySQL, H2, SQLite, Oracle, SQL Server) and Cassandra (CQL). Spark SQL support for distributed queries. Extensions can add other targets.
Is Quill suitable for microservices?
Yes, if queries are stable and known at build time. Compile-time generation keeps runtime overhead minimal. Not ideal for services requiring ad-hoc query composition.

Software development & web development with DEV.co

DEV.co helps companies turn open-source tools like zio-quill into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source databases stack.

Need Scala database expertise?

Our engineers can help you architect compile-time query systems or migrate existing Scala applications to Quill. Contact us to discuss your specific database and performance requirements.