RaisDBRaisDB
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 writes

The shell is read-only by default. Use --readwrite to start in read-write mode, or \mode rw to flip later.

Backslash commands

Session

CommandAction
\q \exit \quitQuit
\h \?Help
\historyPrint path (~/.raisdb_history); use ↑/↓ to browse
CommandAction
\lList databases on the connection
\dtList tables in the current database
\dvList views
\d [table]Describe a table (no arg = list tables)
\c <database>Switch database on the same connection

Display

CommandAction
\xToggle expanded (one-row-per-block) display
\mode ro|readonlySwitch to read-only
\mode rw|readwriteSwitch to read-write
\timing(always-on placeholder — elapsed_ms shows on every result)

Files

CommandAction
\i <file>Execute SQL from a file
\eOpen $EDITOR (default vi) to write a query, then run it

AI

CommandAction
\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.

On this page