Skip to content

Comments

Add Database Admin Dashboard with SQL query execution#3660

Draft
adrw wants to merge 2 commits intomasterfrom
adrw/db-admin-dashboard
Draft

Add Database Admin Dashboard with SQL query execution#3660
adrw wants to merge 2 commits intomasterfrom
adrw/db-admin-dashboard

Conversation

@adrw
Copy link
Collaborator

@adrw adrw commented Feb 9, 2026

Description

Adds a new read-only database admin dashboard tab that enables operators to browse tables, view schemas, and execute read-only SQL queries.

Features:

  • Table browser: View available tables and schemas per registered DataSource
  • Schema viewer: Inspect column names, types, sizes, and nullability constraints
  • Query editor: Execute read-only SQL with comprehensive validation and error messages
  • Results viewer: Paginated results table with 1000-row limit

Backend:

  • AdminDatabaseEntry in misk-jdbc auto-registers writer DataSources via JdbcModule (zero-config)
  • DatabaseQueryAction validates and executes queries on read-only JDBC connections
  • Multi-layered safety: SQL prefix validation, forbidden keyword rejection, statement limits, 30s timeout

Frontend:

  • SSR page (Hotwire + Tailwind CSS) with database dropdown selector
  • Sidebar table list with clickable navigation
  • Query textarea with Stimulus-driven auto-submit
  • Results displayed via turbo-frame

Screenshots

Landing Page

Landing page with database selector

Database Selected with Table List

Table list after selecting a database

Table Schema View

Schema view for the customers table

Query Results

Successful query showing customer data

Query Validation Error

Error message for forbidden DELETE query

Exemplar Sample Service

Added sample migrations to the Exemplar service (samples/exemplar/src/main/resources/migrations/exemplar/) with:

  • customers, products, orders, order_items tables
  • Seed data (5 customers, 7 products, 7 orders, 10 order items)

Run with MySQL locally: gradle :samples:exemplar:run and navigate to /_admin/database-beta/

Testing Strategy

Manual testing in a service with JdbcModule + AdminDashboardModule:

  1. Navigate to /_admin/database-beta/
  2. Select a database → tables auto-populate
  3. Click a table → schema displayed
  4. Execute SELECT queries → results shown
  5. Try INSERT/UPDATE → rejected with helpful error

Checklist

  • Multi-layered read-only safety (validation + isReadOnly = true + rollback)
  • Auto-registration of DataSources via JdbcModule
  • Responsive UI using Tailwind CSS
  • Error handling and validation
  • Row limit (1000) and query timeout (30s)
  • Screenshots from Exemplar sample service
  • Sample migrations with seed data

🤖 Generated with Claude Code

adrw and others added 2 commits February 9, 2026 09:34
Adds a new read-only database admin dashboard tab that enables operators to:
- Browse available database tables per registered DataSource
- View table schemas (columns, types, nullability)
- Execute read-only SQL queries with comprehensive validation
- View results in a paginated table

Backend:
- AdminDatabaseEntry in misk-jdbc auto-registers writer DataSources via JdbcModule
- DatabaseQueryAction validates and executes queries on read-only connections
- Multi-layered safety: SQL prefix checks, forbidden keyword rejection, statement limits

Frontend:
- SSR page (Hotwire + Tailwind CSS) with database selector dropdown
- Table list sidebar with schema viewer
- Query editor with Stimulus-driven form submission
- Results displayed in turbo-frame

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add sample tables (customers, products, orders, order_items) with seed
  data to Exemplar service main resources for demonstrating the database
  admin dashboard
- Add screenshots showing: landing page, database/table selection, schema
  view, query results, and error validation
- Fix th() overload resolution by using named `classes` parameter
- Fix return@build in non-inline lambda by restructuring to if/else

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant