Querying & SQL
The CLI is SQL-first: if a statement works through /v1/api/sql, send it unchanged via kalam --command, kalam --file, or the interactive shell.
Execution options
| Option | Description |
|---|---|
-c, --command <SQL> | Execute one statement and exit. |
-f, --file <PATH> | Execute SQL from file and exit. |
--format <table|json|csv> | Output format (default table). |
--json | Shorthand for --format json. |
--csv | Shorthand for --format csv. |
--no-color | Disable ANSI colors. |
--no-spinner | Disable spinner animations. |
--loading-threshold-ms <MS> | Spinner threshold in milliseconds. |
Common patterns
Namespace state in interactive mode
Namespace switching is SQL, not a backslash command:
After USE NAMESPACE chat, SET NAMESPACE chat, or USE chat, the CLI stores chat locally and sends it as namespace_id on later requests. Unqualified table names resolve to chat.<table> until you switch again. The prompt shows the active namespace as ns:<name>.
Table footer metadata
In table format, results end with row count and footer metadata:
As:— effective user (includesEXECUTE ASand\as)Took:— server-reported execution time in milliseconds
Interactive formatting
| Command | Description |
|---|---|
\dt, \tables | List tables. |
\d <table>, \describe <table> | Describe columns (<table> or <namespace.table>). |
\format table|json|csv | Change output format for the session. |
\refresh-tables, \refresh | Refresh autocomplete table metadata. |
Related
Last updated on