SQLDelight
Kotlin Multiplatform SQL library that generates type-safe Kotlin APIs from .sq SQL files. Unlike ORMs that abstract SQL, SQLDelight writes actual SQL — you write SQL queries, SQLDelight generates Kotlin. Supports Android (Room alternative), iOS, JVM, and JavaScript. Compile-time verified SQL with migration support. Favored for KMP projects that need shared database logic across platforms.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local SQLite library — no network exposure. Compile-time SQL prevents SQL injection. SQLCipher integration for encryption. Cash App maintains.
⚡ Reliability
Best When
You're building a Kotlin Multiplatform app (Android + iOS) and want shared database logic with type-safe SQL rather than ORM abstractions.
Avoid When
You're building JVM-only server-side apps — use Room (Android), Exposed (server), or JOOQ (type-safe SQL on JVM) instead.
Use Cases
- • Share database schema and queries across Android and iOS in Kotlin Multiplatform agent apps using SQLDelight's common SQL module
- • Write raw SQL with compile-time verification — SQLDelight parses .sq files and generates Kotlin type-safe query functions for agent data access
- • Use SQLDelight's coroutine extensions for reactive query streams — queries return Flow<List<T>> that emit on data changes
- • Manage cross-platform schema migrations with SQLDelight's migration files and automatic migration verification
- • Use SQLDelight's IntelliJ plugin for SQL auto-complete, go-to-definition, and rename refactoring in .sq files
Not For
- • Non-SQLite databases — SQLDelight targets SQLite (and PostgreSQL experimental); use Exposed or JOOQ for PostgreSQL/MySQL on JVM
- • Teams that prefer ORM-style entity mapping — SQLDelight requires writing SQL; use Room or Exposed if you prefer declarative entity definitions
- • Server-side heavy CRUD apps without KMP requirements — Exposed or JOOQ are more ergonomic for JVM-only server backends
Interface
Authentication
Database library — no authentication. SQLite encryption via SQLCipher integration available.
Pricing
Cash App open source project. Apache 2.0 license.
Agent Metadata
Known Gotchas
- ⚠ SQLDelight 2.0 is a major rewrite with breaking changes from 1.x — package names, Gradle plugin API, and dialect configuration all changed; check migration guide before upgrading
- ⚠ The IntelliJ plugin is required for IDE support — without it, .sq files are plain text with no autocomplete or type checking in the IDE
- ⚠ SQLDelight generates code into build/ directory — the generated package must be added as a source set in Gradle for IDE recognition
- ⚠ Coroutine extensions require the sqldelight-coroutines-extensions artifact separately — forgetting this means asQueryFlow() is not available
- ⚠ Schema migrations require exact sequential versioning (1.sqm, 2.sqm, etc.) — gaps in migration version numbers cause migration verification failure
- ⚠ SQLDelight's Flow queries emit once immediately on collection, then on data changes — if you need current data only once, use executeAsList() not asFlow() to avoid unnecessary subscriptions
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for SQLDelight.
Scores are editorial opinions as of 2026-03-06.