CLI
Interactive Shell
The `raisdb shell` REPL — SQL with backslash commands.
Start
raisdb shell # pick connection interactively, read-only (default)
raisdb shell main # open the "main" connection
raisdb shell main --readwrite # allow writesThe shell is read-only by default. Use --readwrite to start in read-write mode, or \mode rw to flip later.
Backslash commands
Session
| Command | Action |
|---|---|
\q \exit \quit | Quit |
\h \? | Help |
\history | Print path (~/.raisdb_history); use ↑/↓ to browse |
Navigation
| Command | Action |
|---|---|
\l | List databases on the connection |
\dt | List tables in the current database |
\dv | List views |
\d [table] | Describe a table (no arg = list tables) |
\c <database> | Switch database on the same connection |
Display
| Command | Action |
|---|---|
\x | Toggle expanded (one-row-per-block) display |
\mode ro|readonly | Switch to read-only |
\mode rw|readwrite | Switch to read-write |
\timing | (always-on placeholder — elapsed_ms shows on every result) |
Files
| Command | Action |
|---|---|
\i <file> | Execute SQL from a file |
\e | Open $EDITOR (default vi) to write a query, then run it |
AI
| Command | Action |
|---|---|
\context [tbls] | Print an AI-ready schema summary |
SQL execution
End any statement with ; and press Enter. The shell runs the SQL through check_sql_safety_dialect and reads the engine's dialect so $$ / [] / backticks parse correctly.
Read-only enforcement
Writes in a read-only session are blocked by the safety checker, not by the engine. The shell prints a clear message and points you to \mode rw.
Autocomplete
Tab completion for the backslash commands. Table-name completion after you \dt or \c.
Editor integration
\e drops you into $EDITOR (or vi). Save & quit → the shell runs the buffer.
History
Saved at ~/.raisdb_history. ↑/↓ to navigate. Persists across sessions.