Database Explorer
The Database Explorer gives you direct access to your app's local databases -- SQLite and Room. Browse tables, run SQL queries, and inspect data in real time.
Features
- Discovery of SQLite database files in the app's
databases/folder on Android (opt-in) - Manual registration for Room databases (Room 2 and Room 3)
- SQL Workspace with query editor, favorites, and toolbox
- Query logging for debugging performance
Setup
Room 2 and Room 3 support ships inside the all-in-one Android SDK (ai.snapbug:snapbug, with ai.snapbug:snapbug-no-op in release — see Android SDK). Add no extra dependency.
Do not add snapbug-database-room or snapbug-database-room3 next to the all-in-one. In release they land next to their no-op twins and the build fails with Duplicate class.
Auto-Discovery (Android)
The Database tab shows only what the app hands over — nothing appears by default. To list every SQLite file in the app's databases/ folder (SQLDelight, SQLiteOpenHelper, Room files alike), enable the scan in the start call. Despite its name, room() is that scan:
import io.snapbug.sdk.database.room.room
Snapbug.start(this) {
database { room() }
}Databases stored elsewhere (a custom path, Realm, ObjectBox) are not listed. The iOS SDK, Flutter and React Native have no database support: their Database tab stays empty.
Registering a Room Database
Register a Room database instance with snapbugRegisterDatabase() to query it through Room's own connection (recommended -- avoids locking issues with WAL):
import io.snapbug.sdk.database.room.snapbugRegisterDatabase
val db = Room.databaseBuilder(context, AppDatabase::class.java, "app.db").build()
snapbugRegisterDatabase("app.db", db)For Room 3 (androidx.room3), import from io.snapbug.sdk.database.room3 instead.
Query Logging
Track database queries in real time to identify slow or redundant operations.
With Room
Use the snapbugLogs() builder extension -- it wires Room's setQueryCallback for you:
import io.snapbug.sdk.database.room.extensions.snapbugLogs
Room.databaseBuilder(context, AppDatabase::class.java, "app.db")
.snapbugLogs()
.build()Manual Logging
For other database frameworks, log queries manually:
snapbugLogDatabaseQuery(
databaseName = "my-database",
sqlQuery = "SELECT * FROM users WHERE id = ?",
bindArgs = listOf("42")
)SQL Workspace
The inspector provides a full SQL Workspace with:
- Explore -- browse all tables, columns, and row counts
- Query -- write and execute SQL queries against any database
- Favorites -- save frequently used queries for quick access
- Toolbox -- common operations like export, schema inspection, and table stats
Write operations (INSERT, UPDATE, DELETE) are executed directly on the device database. Use caution when running destructive queries.