DEV.co
Open-Source Databases · sqldelight

sqldelight

SQLDelight is a Kotlin code generator that creates type-safe database APIs directly from your SQL statements and schema. It supports multiple SQL dialects (SQLite, MySQL, PostgreSQL) and platforms (Android, iOS, JVM, JavaScript), with compile-time verification to catch errors early.

Source: GitHub — github.com/sqldelight/sqldelight
6.8k
GitHub stars
572
Forks
Kotlin
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
Repositorysqldelight/sqldelight
Ownersqldelight
Primary languageKotlin
LicenseApache-2.0 — OSI-approved
Stars6.8k
Forks572
Open issues371
Latest release2.3.2 (2026-03-16)
Last updated2026-07-08
Sourcehttps://github.com/sqldelight/sqldelight

What sqldelight is

SQLDelight is a compile-time SQL-to-Kotlin code generator that validates schema, queries, and migrations at build time, supporting Kotlin Multiplatform projects across SQLite, MySQL, and PostgreSQL backends. It eliminates runtime query errors by generating strongly-typed query methods from labeled SQL statements.

Quickstart

Get the sqldelight source

Clone the repository and explore it locally.

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

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

Best use cases

Kotlin Multiplatform Mobile (KMM) Development

Ideal for cross-platform iOS/Android apps needing a single source of truth for database logic. Native support for iOS (via Kotlin/Native), Android, and JVM backends simplifies shared code generation.

Type-Safe SQL with Compile-Time Verification

Best for teams prioritizing early error detection and IDE autocomplete for SQL queries. Schema changes are caught at build time rather than runtime, reducing production issues.

Android and JVM Applications

Well-suited for Android projects and server-side JVM applications using SQLite, MySQL, or PostgreSQL. Integrates naturally with Gradle and Android Studio.

Implementation considerations

  • Requires explicit SQL schema and query files (.sq files); developers must write SQL rather than relying on auto-generated schema.
  • Migration management is manual; schema versioning and migration scripts must be maintained alongside generated code.
  • Gradle build integration is necessary; compilation of .sq files adds a build step that must be configured correctly.
  • IDE plugin available but setup is required for autocomplete and validation features to work in development.
  • Learning curve for teams unfamiliar with SQL-first development; code generation model differs from traditional ORM abstractions.

When to avoid it — and what to weigh

  • Heavy Object-Relational Mapping (ORM) Needs — If you need automatic relationship traversal, lazy loading, or complex entity associations without writing SQL, consider traditional ORMs. SQLDelight requires explicit query definition.
  • Non-Kotlin Technology Stack — SQLDelight generates Kotlin code exclusively. Projects in Java-only, Python, Node.js, or Go ecosystems will not benefit directly.
  • Rapid Prototyping with Minimal Schema Definition — If schema fluidity and minimal upfront SQL writing are priorities, code-first ORM frameworks may be faster. SQLDelight requires explicit schema and query definitions.
  • Unsupported Database Engines — Limited dialect support (no Oracle, SQL Server, CockroachDB as first-class targets). H2/HSQL support is marked experimental.

License & commercial use

Apache License 2.0 (Apache-2.0). This is an OSI-approved permissive open-source license with clear terms for modification, distribution, and use.

Apache 2.0 permits commercial use, modification, and distribution. No licensing fees or commercial restrictions are imposed by the license itself. Verify any proprietary IDE plugin usage aligns with your compliance requirements.

DEV.co evaluation signals

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

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

SQLDelight generates parameterized queries at compile time, reducing SQL injection risk compared to string concatenation. Generated code inherits database driver security posture (e.g., SQLite driver on Android, JDBC driver on JVM). Conduct threat modeling for your specific database backend and network security. No security audit findings are provided in available data.

Alternatives to consider

Room (Android Architecture Components)

Android-native alternative with similar compile-time verification and type-safe query generation. Narrower scope (Android only) but tighter integration with Android APIs.

Exposed (JetBrains ORM/DSL)

Kotlin-native ORM providing both DSL and DAO patterns with less manual SQL. Broader ORM features but less explicit query control than SQLDelight.

jOOQ (Java/Kotlin Query Builder)

Mature SQL builder supporting multiple dialects with compile-time query validation. Commercial licensing available; targets JVM primarily, not Multiplatform.

Software development agency

Build on sqldelight with DEV.co software developers

SQLDelight brings compile-time SQL verification and IDE autocomplete to your Kotlin and Multiplatform applications. Evaluate integration with your schema and database backend, then explore the documentation to plan your migration strategy.

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.

sqldelight FAQ

Does SQLDelight support database migrations?
SQLDelight does not auto-generate migrations. You write migrations manually and SQLDelight verifies query compatibility against your schema at compile time.
Can I use SQLDelight with existing databases?
Yes, SQLDelight understands existing SQL schemas. You define the schema in .sq files and SQLDelight generates queries against it; introspection of live databases is not stated as a feature.
What platforms does SQLDelight support?
SQLite on Android, iOS (via Kotlin/Native), macOS, Windows, JVM, and JavaScript. MySQL and PostgreSQL on JVM. H2/HSQL support is experimental.
Is there a commercial support option?
Not stated in available data. Project is open-source under Apache 2.0. Community support via GitHub issues is available; commercial consulting or support is unknown.

Custom software development services

Adopting sqldelight is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.

Ready to Add Type-Safe SQL to Your Kotlin Project?

SQLDelight brings compile-time SQL verification and IDE autocomplete to your Kotlin and Multiplatform applications. Evaluate integration with your schema and database backend, then explore the documentation to plan your migration strategy.