Skip to content

Add transposed (columns-as-rows) view for query results - #302

Open
jafigueroam94 wants to merge 1 commit into
Maxteabag:mainfrom
jafigueroam94:feat/results-transpose-view
Open

Add transposed (columns-as-rows) view for query results#302
jafigueroam94 wants to merge 1 commit into
Maxteabag:mainfrom
jafigueroam94:feat/results-transpose-view

Conversation

@jafigueroam94

Copy link
Copy Markdown

Summary

  • Press T while the results table is focused to toggle a transposed view of the grid: column names run down the left side, and each original row becomes its own column - useful for wide result sets with many columns and few rows.
  • Works per-section in stacked (multi-statement) results mode; each section keeps its own transpose state independently.
  • Actions that assume "row = DB row, column = DB column" (edit_cell, delete_row, FK/referrers navigation, results filter, and the cell/row "Copy as..." menu) are disabled while transposed, since the cursor's row/column indices no longer map to the original data and would otherwise generate wrong SQL or mislabeled/incorrect copied output.
  • Transposing is display-only: the underlying query result data is never mutated, so untransposing rebuilds the exact original grid.
  • Rows beyond 200 are truncated when transposing (each original row becomes a column, and the Arrow-backed grid isn't built for hundreds of columns), with a warning notification.

No existing feature or open/closed issue/PR covered this - confirmed via a search of the repo's issues, PRs, and source before implementing.

Test plan

  • uv run pytest tests/unit/test_results_transpose.py - pure transpose helper + action-level guards/behavior (fake-app harness, no Textual)
  • uv run pytest tests/ui/test_results_transpose.py - end-to-end pilot tests against a real running app: toggle on/off restores the grid exactly, stacked-mode per-section toggling, focus preservation across repeated toggles, View full uses the transposed column label, new query results reset transpose state, no-results is a no-op
  • uv run pytest tests/ui/keybindings/test_state_machine.py - guard/footer-binding coverage for toggle_transpose and the actions blocked while transposed
  • Full suite: uv run pytest tests/ - 1855 passed, 652 skipped, only 2 pre-existing failures unrelated to this change (test_detect_strategy_pip_user_fallback, test_postgresql.py::TestPostgreSQLIntegration::test_docker_container_connection - both require infra not available in this environment)

Toggle the results grid with T to swap axes - column names down the
left, each row as its own column - useful for wide result sets with
many columns and few rows. Works per-section in stacked (multi-
statement) mode. Actions that assume row=DB row/column=DB column
(edit, delete, FK navigation, filter, and the cell/row "copy as..."
menu) are disabled while transposed to avoid generating wrong SQL or
mislabeled output.
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