Skip to content

CLI

The TensorDB CLI provides an interactive SQL shell powered by clap and rustyline.

Installation

Terminal window
cargo build --release -p tensordb-cli

Usage

Terminal window
# Open a database (creates if doesn't exist)
tensordb-cli ./my_data
# With custom options
tensordb-cli --shard-count 8 ./my_data

Interactive Shell

$ tensordb-cli ./my_data
TensorDB v0.28 — Interactive SQL Shell
Type .help for commands, Ctrl+D to exit.
tensordb> CREATE TABLE users (id TEXT, name TEXT, email TEXT);
OK
tensordb> INSERT INTO users VALUES ('u1', 'Alice', 'alice@example.com');
1 row inserted (commit_ts: 1)
tensordb> SELECT * FROM users;
id | name | email
---+-------+------------------
u1 | Alice | alice@example.com
(1 row)
tensordb> EXPLAIN SELECT * FROM users WHERE id = 'u1';
PointLookup { key: "table/users/u1", cost: 1.00 }

Dot Commands

CommandDescription
.helpShow available commands
.tablesList all tables
.schema <table>Show table schema
.quitExit the shell

Features

  • Tab completion: Table names and SQL keywords
  • History: Arrow keys navigate command history
  • Multi-line: Statements continue until ;
  • Formatted output: Aligned columns with borders