Add click to sort by column in the results window #492
Replies: 2 comments 1 reply
-
it is totally possible. I actually think the data table already implements sorting (without going back to the db), we just don't have an interface for it yet. I think sorting just the data in the table is the best approach here; I don't like datagrip's behavior of rewriting queries by default, since the conflict with The changes would mostly be in the upstream project, https://github.com/tconbeer/textual-fastdatatable; if we want to make this change configurable in that project, we would have to add the right config when initializing the table in Harlequin. There is potentially a related issue, tconbeer/textual-fastdatatable#49, which is that you can't actually select the header row in the data table with the cursor at the moment. The bigger question in my head is if a simple click on the header should sort the table or select the whole column. I'd like to see some research here. As a start: Sorts on Header Click
Selects on Header Click
No-ops on Header Click
Opens Context Menu on Click
AlternativesOther options for sorting on a column:
Other options for selecting a column:
|
Beta Was this translation helpful? Give feedback.
-
Ok - sorry I was confused. Datagrip & DBeaver actually have that behaviour in the SQL editor windows:
So if Harlequin did the former it would be equivalent to Datagrip & DBeaver's behaviour.
Databricks UI does this (again no re-query)
DBeaver does this - by clicking on a little down triangle at the right end of the column header. |
Beta Was this translation helpful? Give feedback.
-
A really useful feature of Datagrip/DBeaver is the ability to sort the results of a query by one column, ascending then descending, from the column title in the results window. Very handy when EDAing query results.
In Harlequin this could be implemented by clicking / terminal cursoring then enter on each column title in the results window.
Harlequin would have to under the hood wrap the user's query in a CTE/subquery, then SELECT * ... ORDER BY {col_name} ASC/DESC then requery the database to get the ordered results.
If fetch_all is being used sorting could also be done directly on the PyArrow results table without a requery.
Is a feature like this feasible Ted? Happy here to contribute code/work on this if it's a goer. 🙌
Beta Was this translation helpful? Give feedback.
All reactions