Inline Editing
Edit, insert, and delete data directly in the results viewer
Inline Editing
data-peek allows you to edit data directly in the results viewer, without writing SQL.
Requirements
To use inline editing:
- Primary Key Required - The table must have a primary key
- SELECT Query - Results must come from a single table
- Active Connection - Must be connected to execute changes
Tables without primary keys cannot be edited inline. This is a safety feature to prevent accidental bulk updates.
Enabling Edit Mode
- Run a query or open a table preview
- Click the Edit button in the results toolbar
- The toolbar changes to show editing options
Editing Cells
Update a Value
- Click on any cell (single click)
- Edit the value in the input field
- Press Enter to confirm or Escape to cancel
- The cell shows with a highlight indicating it's modified
Input Types
data-peek provides type-appropriate inputs:
| Data Type | Input Type |
|---|---|
| text, varchar | Text input / textarea |
| integer, numeric | Number input |
| boolean | Checkbox |
| date | Date picker |
| timestamp | Date-time picker |
| enum | Dropdown with valid values |
| json, jsonb | JSON editor |
Setting NULL
- Clear the input and press Enter
- Or use the NULL button in the cell editor
Adding Rows
- Click Add Row in the edit toolbar
- A new row appears at the bottom with empty values
- Fill in the required columns
- The row shows as "New" until saved
Default values are auto-populated for columns that have them defined.
Deleting Rows
- Click the delete icon (🗑) on any row
- The row is marked for deletion (shown with strikethrough)
- Click again to unmark
Reviewing Changes
Before saving, review your changes:
Pending Changes Count
The toolbar shows:
- X updates - Modified cells
- X inserts - New rows
- X deletes - Rows to delete
Preview SQL
Click Preview SQL to see the generated SQL statements:
-- Updates
UPDATE users SET email = 'new@example.com' WHERE id = 123;
-- Inserts
INSERT INTO users (name, email) VALUES ('John', 'john@example.com');
-- Deletes
DELETE FROM users WHERE id = 456;Saving Changes
Click Save Changes to execute:
- All changes are wrapped in a transaction
- If any statement fails, all changes are rolled back
- On success, results are refreshed
Discarding Changes
Click Discard Changes to:
- Revert all modified cells to original values
- Remove all new rows
- Unmark deleted rows
Reverting Individual Changes
Revert a Cell
Right-click a modified cell and select Revert
Revert a Row
Right-click a row and select Revert Row Changes
Edit Workflow Example
- Query your data:
SELECT * FROM products WHERE category = 'Electronics' - Click Edit to enter edit mode
- Update a product's price by clicking the cell
- Add a new product with Add Row
- Mark an obsolete product for deletion
- Click Preview SQL to review
- Click Save Changes to commit
Safety Features
Transaction Safety
All changes execute in a single transaction. If one fails, everything rolls back.
Validation
- Type checking before save
- Required fields must have values
- Foreign key constraints are validated
Confirmation
Destructive actions (delete, discard) require confirmation.
Limitations
- Cannot edit views (only base tables)
- Cannot edit tables without primary keys
- Cannot edit results from JOINs
- Maximum batch size varies by database