# sqldelight/sqldelight

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/sqldelight-sqldelight).**

6,827 stars · 571 forks · Kotlin · Apache-2.0

## Links

- GitHub: https://github.com/sqldelight/sqldelight
- Homepage: https://sqldelight.github.io/sqldelight/
- awesome-repositories: https://awesome-repositories.com/repository/sqldelight-sqldelight.md

## Topics

`kotlin-multiplatform` `sql` `sqldelight`

## Description

SQLDelight is a Kotlin database library that validates SQL schema, statements, and migrations at compile time, generating type-safe Kotlin query functions from labeled SQL files. It treats SQL as the source of truth for database definitions, catching schema errors during the build process before they reach production.

The library supports multiple database dialects including SQLite, MySQL, PostgreSQL, HSQL, and H2, and generates platform-specific code for Android, iOS, JVM, and JavaScript targets. It provides a platform-specific driver abstraction that handles database connectivity differences across environments, with connection pooling that reserves a dedicated connection for write operations while limiting concurrent readers.

SQLDelight assembles database schemas by applying numbered migration files in order, and generates typed Kotlin APIs that accept parameters and return structured results at runtime. For JavaScript targets, it offloads all database operations to a background web worker to prevent blocking the main thread. The library works with standard JDBC data sources, Android databases, and SQLite files or in-memory databases.

## Tags

### Part of an Awesome List

- [Kotlin SQL Compilers](https://awesome-repositories.com/f/awesome-lists/devtools/common-lisp-libraries/dsl-compilers/kotlin-sql-compilers.md) — Compiles SQL queries into type-safe Kotlin code, catching schema errors at build time.

### Data & Databases

- [Database Driver Abstractions](https://awesome-repositories.com/f/data-databases/database-driver-abstractions.md) — Provides a common database access interface with platform-specific implementations for Android, native, JVM, and JavaScript.
- [Database Drivers](https://awesome-repositories.com/f/data-databases/database-drivers.md) — Creates platform-specific database driver instances for Android, native, JVM, and JavaScript targets. ([source](https://sqldelight.github.io/sqldelight/multiplatform_sqlite))
- [Database Migration Management](https://awesome-repositories.com/f/data-databases/database-migration-management.md) — Applies numbered SQL migration files in order to evolve the database schema.
- [Typesafe Query API Generators](https://awesome-repositories.com/f/data-databases/database-query-execution/query-generators/typesafe-query-api-generators.md) — Creates functions from labeled SQL statements that return typed objects and accept typed parameters. ([source](https://sqldelight.github.io/sqldelight/js_sqlite))
- [SQL Schema Definitions](https://awesome-repositories.com/f/data-databases/database-schema-definitions/sql-schema-definitions.md) — Defines database schemas using SQL statements that are verified at compile time and generate matching Kotlin types. ([source](https://sqldelight.github.io/sqldelight/android_sqlite))
- [Compile-Time Verified Schemas](https://awesome-repositories.com/f/data-databases/database-schema-designers/schema-definitions/compile-time-verified-schemas.md) — Writes table definitions, indexes, and seed data in schema files that are verified at compile time for correctness. ([source](https://sqldelight.github.io/sqldelight/js_sqlite))
- [Typesafe Query Function Generators](https://awesome-repositories.com/f/data-databases/query-optimization-patterns/query-generation-patterns/identifier-to-api-query-generators/typesafe-query-function-generators.md) — Generates typed Kotlin query functions from labeled SQL statements at compile time.
- [Schema Migration Tools](https://awesome-repositories.com/f/data-databases/schema-migration-tools.md) — Assembles database schemas by applying numbered migration files in order.
- [SQL Dialect Adapters](https://awesome-repositories.com/f/data-databases/sql-dialect-adapters.md) — Provides dialect-specific SQL parsing to support multiple database engines at compile time.
- [SQL Query Execution](https://awesome-repositories.com/f/data-databases/sql-query-execution.md) — Runs generated typesafe query functions through a database driver, returning typed objects. ([source](https://sqldelight.github.io/sqldelight/jvm_mysql/))
- [Typesafe Query Executions](https://awesome-repositories.com/f/data-databases/sql-query-execution/typesafe-query-executions.md) — Labels SQL statements to produce generated typed functions that run the statements and return typed objects. ([source](https://sqldelight.github.io/sqldelight/android_sqlite))
- [Typesafe Query Generations](https://awesome-repositories.com/f/data-databases/sql-query-generation/typesafe-query-generations.md) — Generates functions for each labeled SQL statement, returning typed results and accepting typed parameters. ([source](https://sqldelight.github.io/sqldelight/jvm_sqlite))
- [Typesafe Kotlin Code Generators](https://awesome-repositories.com/f/data-databases/sql-to-code-workflows/typesafe-kotlin-code-generators.md) — Compiles SQL schema and queries into type-safe Kotlin code at build time. ([source](https://sqldelight.github.io/sqldelight/))
- [Multi-Database Support](https://awesome-repositories.com/f/data-databases/sqlite-drivers/sqlite-storage-adapters/sqlite-or-postgresql-storage/multi-database-support.md) — Supports multiple interchangeable SQL database backends including SQLite, MySQL, PostgreSQL, and HSQL/H2. ([source](https://cdn.jsdelivr.net/gh/sqldelight/sqldelight@master/README.md))
- [Multi-Platform Database Frameworks](https://awesome-repositories.com/f/data-databases/sqlite-drivers/sqlite-storage-adapters/sqlite-or-postgresql-storage/multi-database-support/multi-platform-database-frameworks.md) — Supports Android, iOS, JVM, and JavaScript with multiple SQL dialects from a single codebase.
- [Schema Migrations](https://awesome-repositories.com/f/data-databases/structural-data-validators/data-structure-migration/schema-migrations.md) — Assembles the database schema by applying numbered migration files in order. ([source](https://sqldelight.github.io/sqldelight/jvm_postgresql))
- [Android Database Access Tools](https://awesome-repositories.com/f/data-databases/android-database-access-tools.md) — Constructs an Android-specific database driver using the generated schema to create or migrate the database. ([source](https://sqldelight.github.io/sqldelight/android_sqlite))
- [Read-Write Connection Limiters](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/connection-transaction-management/connection-pool-managers/backend-server-pools/connection-limit-managers/read-write-connection-limiters.md) — Limits concurrent read connections while reserving a dedicated connection for writes and transactions. ([source](https://sqldelight.github.io/sqldelight/native_sqlite))
- [Write-Reserved Connection Pools](https://awesome-repositories.com/f/data-databases/high-concurrency-database-access/connection-pooling/write-reserved-connection-pools.md) — Implements connection pooling with a dedicated write reservation and reader limits.
- [SQLite Database Management](https://awesome-repositories.com/f/data-databases/sqlite-database-management.md) — Opens SQLite database files or in-memory databases using JDBC connection strings and generated schemas. ([source](https://sqldelight.github.io/sqldelight/jvm_sqlite))

### Development Tools & Productivity

- [SQL Schema Generators](https://awesome-repositories.com/f/development-tools-productivity/type-generators/database-schema/sql-schema-generators.md) — Generates SQL schema definitions from SQL statements in schema files, producing a database class and schema object. ([source](https://sqldelight.github.io/sqldelight/jvm_sqlite))
- [Compile-Time Schema Integrations](https://awesome-repositories.com/f/development-tools-productivity/type-generators/database-schema/sql-schema-integrations/compile-time-schema-integrations.md) — Treats SQL schema files as the source of truth, verified at compile time to generate matching Kotlin types.

### Operating Systems & Systems Programming

- [Platform Support](https://awesome-repositories.com/f/operating-systems-systems-programming/platform-development-integration/platform-support.md) — Supports Android, native, JVM, and JavaScript environments across desktop and mobile. ([source](https://sqldelight.github.io/sqldelight/snapshot))

### Programming Languages & Runtimes

- [SQL Query Extensions](https://awesome-repositories.com/f/programming-languages-runtimes/language-ecosystems-tooling/kotlin-extensions/sql-query-extensions.md) — Creates typed query functions from labeled SQL statements for runtime execution.
- [Typed Query Function Generators](https://awesome-repositories.com/f/programming-languages-runtimes/language-ecosystems-tooling/kotlin-extensions/sql-query-extensions/typed-query-function-generators.md) — Generates typed Kotlin functions from labeled SQL statements for runtime execution. ([source](https://sqldelight.github.io/sqldelight/jvm_mysql/))
- [Multi-Platform Code Generators](https://awesome-repositories.com/f/programming-languages-runtimes/multi-platform-code-generators.md) — Generates platform-specific Kotlin code from a single SQL source for multiple targets.
- [Database Access Code Generators](https://awesome-repositories.com/f/programming-languages-runtimes/multi-platform-code-generators/database-access-code-generators.md) — Generates platform-specific database access code from a single SQL source for Android, iOS, JVM, and JavaScript.
- [Web Worker Execution](https://awesome-repositories.com/f/programming-languages-runtimes/web-worker-execution.md) — Executes all database operations in a background web worker to prevent blocking the main thread. ([source](https://sqldelight.github.io/sqldelight/js_sqlite))

### Software Engineering & Architecture

- [Database Schema Migrations](https://awesome-repositories.com/f/software-engineering-architecture/data-migrators/database-schema-migrations.md) — Assembles database schemas by applying numbered migration files in order.
- [Typesafe SQL Code Generators](https://awesome-repositories.com/f/software-engineering-architecture/schema-generators/procedural-macro-generators/sql-schema-generators/typesafe-sql-code-generators.md) — Generates type-safe Kotlin APIs from SQL schema, queries, and migrations at compile time.

### Testing & Quality Assurance

- [SQL Query Validators](https://awesome-repositories.com/f/testing-quality-assurance/validation-verification/input-validation/compile-time-validators/sql-query-validators.md) — Validates SQL syntax and type safety against a live database schema during the build process.

### Web Development

- [Database API Generation](https://awesome-repositories.com/f/web-development/api-client-generators/type-safe-client-generators/database-api-generation.md) — Generates type-safe database access APIs from SQL schema and queries at compile time. ([source](https://cdn.jsdelivr.net/gh/sqldelight/sqldelight@master/README.md))
- [SQL Schema Validators](https://awesome-repositories.com/f/web-development/schema-validation/sql-schema-validators.md) — Validates SQL schema, statements, and migrations during compilation to ensure correctness before runtime. ([source](https://cdn.jsdelivr.net/gh/sqldelight/sqldelight@master/README.md))
- [Database Connectivity Drivers](https://awesome-repositories.com/f/web-development/database-connectivity-drivers.md) — Opens database connections from standard JDBC data sources for executing generated typesafe queries. ([source](https://sqldelight.github.io/sqldelight/jvm_postgresql))
- [Main Thread Offloading](https://awesome-repositories.com/f/web-development/main-thread-offloading.md) — Offloads database operations to a background web worker to prevent blocking the main JavaScript thread.
