anitnilay20 / anitnilay20/thoth

SQL query editor UI for file viewer

Open
#149 0 comments 0 reactions 0 assignees View on GitHub
feature size:medium ux
Dominant language
Rust
Stars
70
Forks
5
Avg merge
10h 33m
Merged PRs (30d)
2

Description

## Context

UI layer for the DuckDB file query engine epic (#147). Depends on #148 (FileQueryEngine). Surfaces DuckDB's query capabilities to the user without requiring them to know SQL syntax upfront.

## What to build

A query bar that appears below the file viewer toolbar when a file is open. Two modes — toggled by a button:

**Raw mode** (default): existing lazy scroll behaviour, file-loader plugin drives the view.

**Query mode**: user types SQL, hits Run (or ⌘↵), results render via `dataset-bus` → `data-view`.

### Layout

```
┌─────────────────────────────────────────────────────────┐
│ [Raw ↔ Query] SELECT * FROM data WHERE price > 100 │
│ ORDER BY created_at DESC [Run] │
├─────────────────────────────────────────────────────────┤
│ ┌──────────┬──────────┬──────────────┐ │
│ │ name │ price │ created_at │ │
│ ├──────────┼──────────┼──────────────┤ │
│ │ Widget A │ 149.99 │ 2026-07-01 │ │
│ └──────────┴──────────┴──────────────┘ │
│ 42 rows · 12ms │
└─────────────────────────────────────────────────────────┘
```

### Details

- Query input: multi-line `TextEdit`, monospace font, reasonable min-height
- Run shortcut: ⌘↵ (macOS) / Ctrl+↵
- Status line: row count + execution time, or error message in red
- Results: published to `dataset-bus`, rendered via existing `data-view` node — no new table widget needed
- Column schema from `FileQueryEngine::schema()` available for future autocomplete
- Query persists per tab across mode switches (don't clear when toggling back to raw)
- Default query pre-filled as `SELECT * FROM data LIMIT 1000` on first open

## Acceptance criteria

- [ ] Mode toggle button in file viewer toolbar
- [ ] SQL input with ⌘↵ / Ctrl+↵ run shortcut
- [ ] Results render through existing data-view (no new table implementation)
- [ ] Row count and query time shown in status line
- [ ] Errors shown inline below the editor (not a modal)
- [ ] Query string preserved when switching back to raw mode
- [ ] Works for all formats supported by FileQueryEngine

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.