feat: editable query results + empty SELECT rendering - #133
Merged
Conversation
Parse a SELECT statement with sqlparser and decide whether its result rows map back to a single base table. Returns table name + schema for plain single-table SELECTs; otherwise a machine-readable non-editable reason the frontend can surface. Registered as analyze_sql_editability_command. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Empty SELECT result sets returned QueryResult with no columns, so the frontend rendered the DML success message instead of an empty table. Use each driver's statement/stream metadata (postgres prepare, mysql query_iter, sqlserver stream columns) so column names survive zero-row results. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
QueryResultPanel analyzes the executed SQL, fetches primary keys for single-table SELECTs, and passes table/schema/pk props to DataGrid so Edit/Duplicate/Delete work. Non-editable queries surface a specific reason (join/aggregation/cte/union) instead of a generic toast. Also declares rowIndex prop on CellContextMenu to silence the Teleport attribute warning. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Executing on an orphaned tab now opens a dialog offering rebind-to-active-connection, close tab, or cancel, instead of silently dropping the query. Add reattachTab to clear the orphan marker, and record lastExecutedSql so the result panel analyzes the actual executed statement rather than the whole editor buffer. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add per-reason copy (not-select/cte/set-operation/aggregation/multiple-sources/no-table/complex-source) plus the execute-orphan dialog strings in English and Chinese. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes query results editable when the SQL maps back to a single base table, and fixes empty SELECT results being misrendered as DML success messages.
Changes
Backend
analyze_sql_editability_commandusingsqlparserto classify a SELECT as editable (plain single-table) or non-editable with a machine-readable reason (join/aggregation/cte/union/subquery/no-table/not-select). 16 unit tests.prepare, mysqlquery_iter, sqlserver streamcolumns) so the frontend renders an empty table instead of "row(s) affected".Frontend
lastExecutedSqlso the result panel analyzes the actual executed statement, not the whole editor buffer.Testing