Skip to content

feat: interactive data table UX — sorting, copy, EXPLAIN, column reorder #169

@anandgupta42

Description

@anandgupta42

What does this issue track?

Follow-up to PR #141 (data-focused UX polish). The initial PR shipped rich query tables, progress bars, cost badges, schema previews, type indicators, percentage bars, relative timestamps, column statistics, and boolean/NULL styling.

This issue tracks the interactive TUI features that require state management and keyboard handling — higher complexity, separate scope.

Proposed features

  1. Interactive sorting — keyboard shortcuts to sort result table by column (▲/▼ indicators in header, frozen headers while scrolling)
  2. Copy-to-clipboard — select cell/row/column and copy as CSV, JSON, or SQL IN clause (C/J/L shortcuts)
  3. EXPLAIN plan visualization — auto-run EXPLAIN ANALYZE, render as ASCII tree with cost indicators and index usage hints (per-dialect: PostgreSQL, Snowflake, BigQuery, Databricks)
  4. Column reorder + hide/show/ to reorder, H to toggle visibility, persist to session state, show "+ N hidden columns" indicator

Why

These directly address common data engineering workflows:

  • Sorting: avoid rewriting ORDER BY and re-executing queries during exploration
  • Copy: paste IDs into WHERE IN, copy metrics for reports, copy column names for SELECT lists
  • EXPLAIN: instant performance diagnosis without leaving the tool
  • Column reorder: wide result sets (20+ cols) become scannable by hiding noise

Research source

Full research in memory: competitive analysis of DataGrip, DBeaver, Snowsight, k9s, lazygit patterns. See PR #141 discussion for screenshots of the foundation these build on.

Implementation notes

  • All features require interactive TUI state (keyboard event handlers, re-render on state change)
  • Sorting and column reorder can share a column state management layer
  • EXPLAIN is the highest complexity — requires per-dialect SQL parsing (~200 LOC per DB)
  • Copy needs Node.js clipboard integration
  • Each feature can be shipped independently

Checklist

  • Interactive sorting with header indicators
  • Copy-to-clipboard (cell, row, column, SQL formats)
  • EXPLAIN plan ASCII tree visualization
  • Column reorder + hide/show with session persistence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions