Database Explorer

AndroidiOSDesktop

The Database Explorer gives you direct access to your app's local databases -- SQLite, Room, and SQLDelight. Browse tables, run SQL queries, and inspect data in real time.

Features

  • Auto-detection of Room databases on Android
  • Manual registration for custom databases
  • SQL Workspace with query editor, favorites, and toolbox
  • Query logging for debugging performance
  • Multiplatform support via absolute path registration

Auto-Detection (Android)

On Android, Snapbug automatically detects Room databases. No additional setup is required beyond initializing the SDK.

Manual Registration

For databases that are not auto-detected, register them manually using snapbugRegisterDatabase():

// Register a database by name and instance
snapbugRegisterDatabase("my-database", databaseInstance)

Multiplatform Registration

For Kotlin Multiplatform projects, register databases using their absolute path:

// Register using absolute file path
snapbugRegisterDatabase("my-database", absolutePath = databaseFile.absolutePath)
info

On iOS and Desktop, auto-detection is not available. Always use manual registration with the absolute path.

Query Logging

Track database queries in real time to identify slow or redundant operations.

With Room

Use Room's built-in setQueryCallback to forward queries to Snapbug:

Room.databaseBuilder(context, AppDatabase::class.java, "app.db")
    .setQueryCallback({ sqlQuery, bindArgs ->
        snapbugLogDatabaseQuery(
            databaseName = "app.db",
            query = sqlQuery,
            args = bindArgs
        )
    }, Executors.newSingleThreadExecutor())
    .build()

Manual Logging

For other database frameworks, log queries manually:

snapbugLogDatabaseQuery(
    databaseName = "my-database",
    query = "SELECT * FROM users WHERE id = ?",
    args = listOf("42")
)

SQL Workspace

The Desktop app 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
warning

Write operations (INSERT, UPDATE, DELETE) are executed directly on the device database. Use caution when running destructive queries.