Delight SQL Viewer
⚠️ Deprecated: Delight SQL Viewer is no longer actively maintained.
For an improved, unified debugging experience — including database inspection, logging, network monitoring, and more — please migrate to Kick: Kotlin Inspection & Control Kit.
Delight SQL Viewer is a Kotlin Multiplatform library for Android, iOS, and Desktop applications. It supports both SQLDelight and Room Multiplatform databases. With version 2.0.0, developers and testers can view, edit, add, and delete records directly within the app—making debugging and QA efficient by enabling real-time inspection and modification of your app’s database state.
Screenshots
Features
- Multiplatform Support: Runs on Android, iOS, and Desktop.
- Dual Database Support: Seamlessly work with both SQLDelight and Room databases.
- Database Inspection: View, edit, add, and delete records directly from your app.
- App Shortcuts: Automatically adds a shortcut entry for quick access (configurable).
Table of Contents
Installation
Delight SQL Viewer is published to Maven Central. Add the dependency to your shared (common) module:
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api("ru.bartwell.delightsqlviewer:runtime:2.0.0")
api("ru.bartwell.delightsqlviewer:core:2.0.0")
api("ru.bartwell.delightsqlviewer:sqldelight-adapter:2.0.0")
}
}
}
}
For iOS, export the dependencies in your framework {} block to make them available in your iOS framework:
framework {
export("ru.bartwell.delightsqlviewer:runtime:2.0.0")
export("ru.bartwell.delightsqlviewer:core:2.0.0")
export("ru.bartwell.delightsqlviewer:sqldelight-adapter:2.0.0")
}
Initialization
After adding the appropriate dependencies, initialize Delight SQL Viewer in your platform-specific code by providing the corresponding environment provider along with the database driver.
Android
For SQLDelight:
DelightSqlViewer.init(object : SqlDelightEnvironmentProvider() {
override fun getDriver() = sqlDelightDriver
override fun getContext() = this@MainActivity
})
For Room:
DelightSqlViewer.init(object : RoomEnvironmentProvider() {
override fun getDriver() = roomDatabase
override fun getContext() = this@MainActivity
})
Note: Both providers require an Android Context along with the respective database instance.
iOS
For SQLDelight:
let provider = SqlDelightEnvironmentProvider(driver: sqlDriver)
DelightSqlViewer.shared.doInit(provider: provider, isShortcutEnabled: true)
For Room:
let provider = RoomEnvironmentProvider(driver: roomDatabase)
DelightSqlViewer.shared.doInit(provider: provider, isShortcutEnabled: true)
Note: The isShortcutEnabled parameter determines whether a shortcut is added to the app icon.
Desktop
For SQLDelight:
DelightSqlViewer.init(object : SqlDelightEnvironmentProvider() {
override fun getDriver() = sqlDelightDriver
})
For Room:
DelightSqlViewer.init(object : RoomEnvironmentProvider() {
override fun getDriver() = roomDatabase
})
Note: The isShortcutEnabled parameter determines whether the “SQL Viewer” item is added to the Taskbar/Dock context menu.
Launching the Viewer
Once initialized, you can launch the viewer with a simple call:
Android / Desktop
Button(onClick = { DelightSqlViewer.launch() }) {
Text(text = "Launch viewer")
}
iOS
Button("Launch viewer") {
DelightSqlViewer.shared.launch()
}
Using a Custom Theme
Starting with version 2.1.0, you can specify a custom theme when launching the viewer. By default, DelightSqlViewer.launch() uses Theme.Auto, but you may also call:
DelightSqlViewer.launch(theme = Theme.Dark)
DelightSqlViewer.launch(theme = Theme.Light)
DelightSqlViewer.launch(theme = Theme.Custom(myColorScheme))
Theme.Custom takes a Material 3 ColorScheme, allowing you to tailor the viewer’s UI to match your app's design.
For iOS, pass the chosen theme to the launch(theme:) method:
Button("Launch viewer in Dark theme") {
DelightSqlViewer.shared.launch(theme: Theme.Dark())
}
Shortcuts
Android Shortcut
By default, Delight SQL Viewer adds a shortcut to your app’s launcher icon (accessible via long-press). To disable it, pass isShortcutEnabled = false during initialization:
DelightSqlViewer.init(
provider = object : SqlDelightEnvironmentProvider() {
override fun getDriver() = sqlDelightDriver
override fun getContext() = this@MainActivity
},
isShortcutEnabled = false,
)
iOS Shortcut
On iOS, the library adds a shortcut on the app icon by default. To handle shortcut actions, configure your AppDelegate or UISceneDelegate as follows:
class AppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
: .
) -> {
.shared.getConfiguration(session: connectingSceneSession)
}
}
Desktop Shortcut
By default, Delight SQL Viewer adds a “SQL Viewer” item to your app’s Taskbar/Dock context menu. To disable it, pass isShortcutEnabled = false during initialization:
DelightSqlViewer.init(
provider = object : SqlDelightEnvironmentProvider() {
override fun getDriver() = sqlDelightDriver
},
isShortcutEnabled = false,
)
Excluding the Library in Release Builds
Since the viewer is primarily for debugging and development, you may want to exclude it from release builds.
Using the Stub Library
For release builds, depend on the stub module instead of the full implementation:
val isRelease =
framework {
if (isRelease) {
export("ru.bartwell.delightsqlviewer:stub:2.0.0")
} else {
export("ru.bartwell.delightsqlviewer:runtime:2.0.0")
export("ru.bartwell.delightsqlviewer:core:2.0.0")
export("ru.bartwell.delightsqlviewer:sqldelight-adapter:2.0.0")
}
}
And in your dependencies:
dependencies {
if (isRelease) {
api("ru.bartwell.delightsqlviewer:stub:2.0.0")
} else {
api("ru.bartwell.delightsqlviewer:runtime:2.0.0")
api("ru.bartwell.delightsqlviewer:core:2.0.0")
api("ru.bartwell.delightsqlviewer:sqldelight-adapter:2.0.0")
}
}
Omitting Initialization and Launch
Alternatively, you can simply avoid calling DelightSqlViewer.init(...) and DelightSqlViewer.launch() in release builds. However, using the stub dependency is generally preferred to prevent unnecessary code inclusion.
Contributing
Contributions are welcome! Please feel free to open an issue or submit a pull request with any improvements or suggestions.
License
Copyright 2025 Artem Bazhanov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:
Delight SQL Viewer is distributed under the Apache License, Version 2.0.
Happy debugging! If you have any questions or need further assistance, feel free to open an issue.