Skip to content

Overview

SQLDelight generates typesafe kotlin APIs from your SQL statements. It verifies your schema, statements, and migrations at compile-time and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple.

SQLDelight understands your existing SQL schema.

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

It generates typesafe code for any labeled SQL statements.

intro.gif


SQLDelight supports a variety of dialects and platforms:

SQLite

MySQL (JVM)

PostgreSQL (JVM) (Experimental)

HSQL/H2 (JVM) (Experimental)

Snapshots

Snapshots of the development version (including the IDE plugin zip) are available in Sonatype's snapshots repository. Note that all coordinates are app.cash.sqldelight instead of com.squareup.sqldelight for 2.0.0+ SNAPSHOTs.

// settings.gradle.kts
pluginManagement {
    repositories {
        gradlePluginPortal()
        maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
    }
}

// build.gradle.kts
plugins {
    id("app.cash.sqldelight") version "SNAPSHOT-VERSION"
}

repositories {
    maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}
// settings.gradle
pluginManagement {
    repositories {
        gradlePluginPortal()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
}

// build.gradle
plugins {
    id "app.cash.sqldelight" version "SNAPSHOT-VERSION"
}

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

Alpha IDE plugins are also available by using the alpha channel in IntelliJ: https://plugins.jetbrains.com/plugins/alpha/com.squareup.sqldelight. Snapshots are also available in the EAP channel: https://plugins.jetbrains.com/plugins/eap/com.squareup.sqldelight

IntelliJ_alpha_channel