Skip to content

Overview

SQLDelight 2.0

If you are currently using SQLDelight 1.x, check out the docs on upgrading to SQLDelight 2.0!

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 takes your existing SQL schema,

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

and generates typesafe code to run your SQL statements and queries.

intro.gif


Supported Dialects and Platforms

SQLDelight supports a variety of SQL dialects and platforms.

Third party dialects

CockroachDB


JVM

DB2


JVM

Oracle DB


JVM

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.

Documentation pages for the latest snapshot version can be found here.

// 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