Open-source project
sqldelight/sqldelight avatar
sqldelight/sqldelight

SQLDelight turns the SQL you already wrote into typed Kotlin

SQLDelight - Generates typesafe Kotlin APIs from SQL

6,907 stars583 forksKotlinApache-2.0

At a glance

What is it?
SQLDelight reads a SQL schema and labeled statements, then generates typed Kotlin APIs while checking the schema, the statements and the migrations at compile time. Outside SQLite the dialect list narrows to the JVM, and HSQL/H2 is still marked experimental.
Who is it for?
SQLDelight fits a team that already writes SQL by hand for Android, JVM, native or browser targets and wants the schema and the statements checked by the compiler instead of by the next reviewer. It does not fit a team that needs MySQL or PostgreSQL off the JVM, a build that has to stay outside Gradle, or anyone looking for a mapping layer to migrate to.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 3 days ago.
What is it written in?
Mainly Kotlin, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • sqldelight/sqldelight6,907 ★ · +22
Star history
Repository2026-09-232026-11-15
sqldelight/sqldelight6.9k6.9k

22 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Three things get checked before your Kotlin runs

The schema, the statements and the migrations. That list is the whole pitch, and it arrives in a single sentence at the top of the README. You keep the SQL, and the Kotlin you do not write is generated from it, with types taken from the column definitions and one function per labeled statement.

The output language is not negotiable. The repository description reads SQLDelight generates typesafe Kotlin APIs from SQL, the tree is written in Kotlin, and no other target language appears anywhere in the project documentation. A team whose data layer lives in Swift, Java or TypeScript gets nothing here, and no adapter in the top-level entries changes that.

The IDE half of the promise comes out of the same understanding. Autocomplete and refactoring are named as consequences of checking statements at compile time, which is why the IntelliJ side is its own top-level module, sqldelight-idea-plugin, sitting beside the compiler and the Gradle plugin instead of living inside either of them.

The repository's only SQL example is a three column table

The README ships exactly one fenced block, and it is a schema:

sql
CREATE TABLE hockey_player (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL,
  number INTEGER NOT NULL
);

Plain SQLite DDL, three columns, every one of them NOT NULL, with an INTEGER PRIMARY KEY AUTOINCREMENT carrying the identifier. The plainness is the argument. SQLDelight understands your existing SQL schema, so you are not declaring the same table a second time in some other notation and keeping the two in sync.

Two things follow from that choice, and both are gaps. The README never shows what a label on a statement looks like, so the syntax that turns a SELECT into a Kotlin function has to be picked up elsewhere. It never shows how a schema file is laid out either, so the file layout of a project is not something you can read off this page either.

MySQL and PostgreSQL stop at the JVM, HSQL/H2 is experimental

The platform list is long and uneven. SQLite is the deep one: Android, Native covering iOS, macOS and Windows, JVM, JavaScript and Multiplatform, each with its own documentation page. Then MySQL (JVM) and PostgreSQL (JVM) as single entries, and HSQL/H2 (JVM) marked Experimental.

Read those parentheses as the constraint they are. If you ship an iOS or desktop app against MySQL, the list offers you nothing for that target. Dialects and drivers live in separate top-level directories, dialects/ and drivers/.

Multiplatform is where the layout shows the intent. The sample project carries separate common, android and iosApp roots, which is one shared schema checked against more than one target instead of a fresh copy of the queries per platform.

Compile time checking moves the failure, it does not remove it

A query that no longer matches the schema stops the build instead of the app. That is the good half of the trade, and it is why people who already write SQL by hand tend to like the idea.

The other half is what you hand back. There is no described path for assembling SQL at runtime and passing the string to the generated layer, so code that used to build a query dynamically has to change shape, not just change imports. The README describes no escape hatch for a statement the compiler could not have seen.

Migrations are treated the same way. The README counts them among the three things verified at compile time, and the tree carries a dedicated sqlite-migrations module next to the compiler. What is not explained anywhere here is how a migration is authored, how several of them are ordered, or what happens when one that already reached users turns out to be wrong. If you need that answer, the project website is the only source offered.

So the bargain is worth stating plainly. You get a column rename that becomes a Kotlin compile error, and you get SQL that is no longer a string your code can bend at will.

No plugin coordinate, no command line, no benchmark table

In roughly 200 words of README there is no installation command, no Gradle plugin coordinate and no version to pin. It opens by pointing at the project website for documentation and APIs, and closes with the Apache 2.0 text under a 2016 Square, Inc. copyright. Everything you need to start is one hop away from this repository rather than inside it.

There is no command line entry point in the top-level entries either. What sits at the root is build.gradle, settings.gradle, gradle.properties, gradlew and gradlew.bat, with buildLogic/ and the modules beside them, so the compiler reaches your project through the Gradle build rather than through a binary you run yourself. The README names no route for a build that stays outside Gradle.

On comparisons, this repository does not contain one. No benchmark output, no table against Room, Realm or Exposed, and no guide for moving an existing mapping layer onto SQLDelight. The project's own answer is that you bring the SQL you already have, so the difference in approach has to be worked out against your own schema rather than read off a comparison page.

Three release tags and a separate snapshot channel

Release history is short and steady: 2.4.1 on 2026-10-06, 2.4.0 on 2026-09-18, 2.3.2 on 2026-03-16, with the last push landing on 2026-10-25. The repository is not archived, and the tags move one step at a time rather than jumping minor versions.

Distribution is split in two. Tagged releases are what a Gradle build resolves. Development snapshots live in the Sonatype Central Portal snapshots repository, and those include the IDE plugin zip. The plugin is therefore described only as a snapshot artifact, so there is no released plugin build named here for you to pin against a released compiler. Documentation for the snapshot build is published separately under sqldelight.github.io/sqldelight/snapshot, which quietly tells you to read a different set of pages when you are on a snapshot.

Licensing is the easy part: Apache 2.0, with no per-module exception or added restriction called out anywhere in the tree.

sample/ and sample-web/ carry the same schema two ways

Two sample trees ship with the repository. The first is a self contained Gradle build with its own gradlew, gradlew.bat, settings.gradle, gradle.properties and build.gradle, split into common, android and iosApp roots. The second, sample-web/, sits beside it as a separate web target. Together they line up with the platform list: native and Android sharing the common root, JavaScript in a tree of its own.

Neither one is explained in the README; the sample tree carries its own sample/README.md. You will not learn from this repository what a generated query looks like at the call site, or how the Android and iOS roots hand one schema to different drivers. The website is listed as the place for documentation and APIs, and it is the only source named here.

The consequence is a short first session. Read the page for the target you ship, take the schema shape from the common root, then fix whatever the first Gradle build tells you. The compile time checking that makes the tool pleasant once it is set up is the same thing that makes it opaque before it is.

Editorial conclusion

SQLDelight fits a team that already writes SQL by hand for Android, JVM, native or browser targets and wants the schema and the statements checked by the compiler instead of by the next reviewer. It does not fit a team that needs MySQL or PostgreSQL off the JVM, a build that has to stay outside Gradle, or anyone looking for a mapping layer to migrate to. Before you commit, verify two things this repository does not carry: the plugin coordinate and version for the target you ship, and whether a migration can be corrected once it has shipped.

Frequently asked questions

What is SQLDelight?

SQLDelight generates typesafe Kotlin APIs from your SQL statements, verifying your schema, statements and migrations at compile time and adding IDE autocomplete and refactoring on top. It reads an existing SQL schema rather than asking you to describe the same table a second time.

Can I use SQLite with Kotlin?

Through SQLDelight, yes. SQLite is its deepest dialect, supported on Android, Native for iOS, macOS and Windows, JVM, JavaScript and Multiplatform, with the generated API written in Kotlin.

How does SQLDelight compare with Room on performance?

The repository publishes no benchmark and makes no comparison with Room, so a performance claim cannot be checked against it. What it does state is that statements, schema and migrations are verified at compile time, which removes runtime parse failures but says nothing about query speed.

Is SQLDelight the same thing as SQLite?

No. SQLite is the database SQLDelight compiles against on the Android, native, JVM and browser targets. SQLDelight is the Kotlin side of that pairing: a compiler, a Gradle plugin and an IntelliJ plugin that turn labeled statements into typed Kotlin APIs.

What alternatives to SQLDelight does the project name?

None. The project names no alternative tool of its own. Its range is the closest thing on offer: SQLite across five targets, MySQL and PostgreSQL on the JVM only, and HSQL/H2 on the JVM marked experimental.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. Releases
  5. sqldelight/sqldelight on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/sqldelight-sqldelight.svg)](https://hysenlabs.com/projects/sqldelight-sqldelight)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/sqldelight-sqldelight.svg)](https://hysenlabs.com/projects/sqldelight-sqldelight)

Was this useful?