Database Explorer

AndroidiOS

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

  • Auto-discovery of SQLite database files on Android
  • Manual registration for Room databases (Room 2 and Room 3)
  • SQL Workspace with query editor, favorites, and toolbox
  • Query logging for debugging performance

Setup

Pick the artifact that matches your Room version:

dependencies {
    // Room 2.x
    debugImplementation("ai.snapbug:snapbug-database-room:0.1.0")
    releaseImplementation("ai.snapbug:snapbug-database-room-no-op:0.1.0")
 
    // Room 3.x
    debugImplementation("ai.snapbug:snapbug-database-room3:0.1.0")
    releaseImplementation("ai.snapbug:snapbug-database-room3-no-op:0.1.0")
}

Both artifacts expose the same API.

Auto-Discovery (Android)

On Android, Snapbug scans your app's data directories and lists every SQLite database file it finds. No additional setup is required beyond initializing the SDK.

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
 
snapbugRegisterDatabase("app-database", appDatabase)

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.