CLI PSQL client. Why? Cause fuck DBeaver
go install github.com/SunnyWan59/sqlrat@latestOr build from source:
git clone https://github.com/SunnyWan59/sqlrat.git
cd sqlrat
go build -o sqlratAsk Claude for SQL help directly in the editor:
- Press
Alt+I(Option+I on Mac) in the editor to open the Claude modal - Type what you want to do (e.g., "create a users table", "fix this query")
- Claude sees your current SQL and available tables
- Press Enter to get pure SQL code back
- The response replaces your editor content
- Set your API key in
.env:ANTHROPIC_API_KEY=sk-ant-api03-...
Results Table:
- Copy Cell: Press
yon any cell to copy its value to clipboard - Visual Mode: Press
Vto enter visual selection mode- Use
hjklor arrow keys to expand selection h/lexpands horizontally (columns)j/kexpands vertically (rows)- Press
yto copy selection to clipboard (tab-delimited for columns, newline-delimited for rows) - Press
Escto exit visual mode
- Use
- Paste: Press
pto paste clipboard content into cells- Pastes tab-delimited data across columns
- Pastes newline-delimited data across rows
- Works on both new rows and existing editable rows
- Edit Mode: Press
eto edit a cell, thenCtrl+Vto paste clipboard content into the edit field
SQL Editor:
- Copy All SQL: Press
Ctrl+Yto copy all SQL in the editor to clipboard - Paste SQL: Press
Ctrl+Vto paste clipboard content into editor
Navigation:
Tab/Shift+Tab- Cycle between panes (sidebar, editor, results)hjklor arrow keys - Navigate within focused pane
SQL Editor:
Ctrl+J- Execute SQL statement at cursorCtrl+E- Execute all SQL in editorCtrl+Y- Copy all SQL to clipboardCtrl+V- Paste from clipboardCtrl+O- Open scripts modalAlt+I- Ask Claude AI for SQL help (opens modal)Tab- Accept autocomplete suggestion
Results Table:
e- Edit celly- Copy cell (or selection in visual mode)p- Paste from clipboardV- Toggle visual selection modeE- Export results (choose CSV, JSON, or TSV)d- Delete row (toggle)a- Add new rowv- Preview cell in large viewer/- Search/filter rowsn/N- Next/previous search matchg/G- Jump to top/bottom
Sidebar:
Enter- Select table/database/- Search tablesD- Toggle between tables and databases viewc- Copy database (when in databases view)x- Drop database (when in databases view)
Global:
Ctrl+S- Commit pending changesCtrl+X- Clear all pending changesCtrl+R- Reconnect to databaseCtrl+C- Quit
Copy a single cell:
1. Navigate to cell with hjkl
2. Press y
Copy multiple columns:
1. Press V to enter visual mode
2. Press l (or right arrow) to expand right
3. Press y to copy (copies tab-delimited)
Copy multiple rows:
1. Press V to enter visual mode
2. Press j (or down arrow) to expand down
3. Press y to copy (copies newline-delimited)
Copy a block (multiple rows and columns):
1. Press V to enter visual mode
2. Use hjkl to select desired range
3. Press y to copy (copies as TSV format)
Paste data:
1. Copy data from anywhere (Excel, CSV, etc.)
2. Navigate to target cell
3. Press p to paste
4. Data will be distributed across cells based on tabs and newlines