Skip to Content
Interactive Commands

Interactive Commands

Launch interactive mode with kalam (no --command or --file). Type SQL directly or use backslash meta-commands. --command also accepts meta-commands for one-shot cluster and admin operations.

Core shell and inspection

CommandDescription
\help, \?Show help.
\quit, \qExit CLI.
\info, \sessionSession, server URL, health, version, cluster, config.
\sessionsActive PostgreSQL gRPC bridge sessions from system.sessions.
\history, \hOpen command history menu.
\healthUnauthenticated public health probes.
\stats, \metricsQuery system stats metrics.

\health uses /health and /v1/api/healthcheck without authenticated SQL. On remote deployments those endpoints may be localhost-only.

\sessions runs:

SQL
SELECT *FROM system.sessionsORDER BY last_seen_at DESC, session_id;

For active transactions across pg_kalam and /v1/api/sql:

SQL
SELECT transaction_id, owner_id, origin, state, write_countFROM system.transactionsORDER BY origin, transaction_id;

See system views for columns and patterns.

Namespace, schema, impersonation

CommandDescription
\dt, \tablesList tables.
\d <table>, \describe <table>Describe columns.
\as <user_id> <SQL>Wrapper for EXECUTE AS '<user_id>'.
\format table|json|csvChange output format.
\refresh-tables, \refreshRefresh autocomplete metadata.
SQL
USE NAMESPACE chat;SELECT * FROM messages WHERE conversation_id = 42;\flush table messages\as user_123 SELECT * FROM app.messages WHERE conversation_id = 42;

\flush shortcuts STORAGE FLUSH:

  • \flush or \flush allSTORAGE FLUSH ALL in current namespace
  • \flush table messagesSTORAGE FLUSH TABLE chat.messages when namespace is chat
  • \flush table billing.invoices — preserves explicit namespace

See impersonation for delegation rules.

Table transfer

CommandDescription
\export <namespace.table> [--user-id <id>] [--output <file.zip>]Export table to local ZIP.
\import <namespace.table> <file.zip> [--user-id <id>]Import ZIP into target table.
  • Runs async server jobs with progress polling
  • User tables require --user-id when applicable
  • <namespace.table> is required; unqualified names are rejected
SQL
\export app.orders --output ./orders-backup.zip\import app.orders_restored ./orders-backup.zip\export app.user_profile --user-id user_123 --output ./profile-user123.zip

Credentials

CommandDescription
\show-credentials, \credentialsShow stored credentials for current instance.
\update-credentials <user> <pass>Update credentials.
\delete-credentialsDelete credentials for current instance.

Live queries

CommandDescription
\live <SQL>, \subscribe <SQL>Start live subscription.

See Live Subscriptions.

Topic consumer

CommandDescription
\consume <topic> [--group NAME] [--from earliest|latest|OFFSET] [--limit N] [--timeout SECONDS]Consume topic messages.

See Topic Consumers.

Cluster and ingest

CommandDescription
\flush [all|table <table>]STORAGE FLUSH in current namespace context.
\cluster snapshotTrigger cluster snapshot.
\cluster purge --upto <index>Purge Raft logs up to index.
\cluster trigger-electionTrigger elections across groups.
\cluster transfer-leader <node_id>Request leader transfer.
\cluster rebalanceRebalance data-group leaders.
\cluster stepdownRequest leader stepdown.
\cluster clearClear older snapshot files.
\cluster list, \cluster lsNode overview from system.cluster.
\cluster list groupsRaft group details.
\cluster join <node_id> <rpc_addr> <api_addr>Add a node at runtime.

One-shot examples:

BASH
kalam --command "\\cluster list"kalam --command "\\cluster rebalance"kalam --command "\\cluster join 2 10.0.0.2:2910 http://10.0.0.2:2900"

Cluster routing details: SQL Workflows.

Last updated on