Skip to content

Interactive SQL REPL mode for exploratory data analysis #67

@vmvarela

Description

@vmvarela

Description

Add an interactive REPL (Read-Eval-Print Loop) where users can load data once and execute multiple SQL queries in a shell-like interface, with persistent context, history, and special meta-commands.

This shifts sql-pipe from a one-shot CLI tool to an interactive data exploration platform — enabling exploratory data analysis (EDA) workflows that are currently impossible.

Example session

$ sql-pipe --repl
sql-pipe> \load sales.csv
Loaded 12,483 rows into table "stdin" (5 columns detected)
sql-pipe> SELECT region, SUM(amount) FROM stdin GROUP BY region;
region,total
EMEA,142350.00
APAC,98210.50
AMER,203100.75
sql-pipe> \describe
Table: stdin
  id       INTEGER
  region   TEXT
  product  TEXT
  amount   REAL
  date     TEXT
sql-pipe> \save results.csv
Saved 3 rows to results.csv
sql-pipe> \quit

Acceptance Criteria

  • --repl or -i flag launches interactive mode
  • Data can be loaded from files via \load <file> or piped via stdin before entering REPL
  • Multiple SQL queries can be executed against the same loaded data
  • Meta-commands: \load <file>, \save <file>, \describe, \tables, \quit
  • Query history persisted across sessions (~/.sql-pipe_history)
  • Graceful exit with \quit, \q, or Ctrl+D
  • Existing one-shot behavior unchanged when --repl is not used

Notes

  • Consider a simple line-editing library for readline-like behavior (history, cursor movement)
  • The REPL is a new execution mode — the core SQL engine and CSV parser remain the same
  • Multi-line queries could be supported by detecting unterminated statements (no trailing ;)
  • This is a size:l issue but could be split if needed (basic REPL first, then meta-commands, then history)

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumShould be done soonsize:lLarge — 1 to 2 daysstaleInactive issue — review in next refinementstatus:readyRefined and ready for sprint selectiontype:featureNew functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions