SQL & Explain
krishiv sql and krishiv explain flags, --mode, --local, --remote, --timeout, --api-key.
Both commands share the same flags. explain additionally prints the logical and physical plan.
Usage
krishiv sql --query "SELECT 42 AS answer"
krishiv sql --local --mode single-node --query "SELECT 1"
krishiv sql --remote -c http://127.0.0.1:50051 --query "SELECT 1"
krishiv sql --api-key dev-key --query "SELECT * FROM people"
krishiv explain --query "SELECT * FROM orders WHERE amount > 100"
Flags
| Flag | Effect |
|---|---|
-q, --query <SQL> (required) | The statement to run. Multi-statement is supported with ; separator; only the last statement's result is printed. |
--mode <embedded|single-node|distributed> | Override the runtime mode for this query. Default: embedded. |
--local | Shortcut for --mode single-node. Also uses Session::execute_local instead of Session::sql, which never routes to a remote coordinator even if one is configured. |
--remote | Use Session::execute_remote. Requires a configured coordinator (KRISHIV_COORDINATOR or -c). Fails with a clear error if no coordinator is reachable. |
--timeout <SECS> | Per-query timeout in seconds. Default: 30. |
--api-key <KEY> | Authenticate the query with a static API key. Server-side keys are configured via KRISHIV_API_KEYS=key1=user,key2=svc,.... |
--parquet <table=path> | Register a Parquet file as a SQL table before running the query. Repeatable. |
Multi-statement
--query can contain multiple statements separated by ;. Only the last statement's result is printed. To capture intermediate results, run them as separate invocations.
Output
| Statement | Output |
|---|---|
SELECT | ASCII table with up to --limit rows. |
EXPLAIN (any statement) | Plan text after the result. |
CREATE / DROP | "OK" with timing. |
INSERT / MERGE / UPDATE / DELETE | Affected row count and timing. |
START PIPELINE | Sink output (memory, console) and the running query ID. |
Environment variables
| Variable | Effect |
|---|---|
KRISHIV_COORDINATOR | Default coordinator URL for --remote. |
KRISHIV_MODE | Default mode for the CLI (overridden by --mode). |
KRISHIV_REMOTE_EXEC | 1 / true / yes / on forces execute_remote. |
KRISHIV_API_KEYS | Server-side: comma-separated key=user pairs for API key auth. |