Oko/Docs

Command reference

oko database read

Reads the rows of one table in the signed-in member's organization, as that member's session may read them, and prints them as a JSON array; the organization filter is always added by Oko.

Invocation#

Command
oko database read --table NAME [--query PARAMS] [--json]

Inputs and options#

  • --table: letters, digits and underscores. --query: PostgREST parameters appended after the organization filter; one with `order=` is read page by page to the end, one without is a single page of at most a thousand rows.

Output and state effect#

  • Reads only.
  • A paged read is one wait on standard error: `czekam: GET <table address> page by page; gdzie: the shared Oko database; rodzaj: baza; …` before the first page and one `koniec czekania` after the last, or `blad czekania` with the failed page's own address, time and cause. Its pages write no wait lines of their own; every paged read of every Oko command (tasks, defects, telemetry and the rest) is written the same way. The journey `tests/database/paged_waits.rs` (`cargo test --manifest-path rust/Cargo.toml --test database-paged-waits`) reads `oko_operator_messages` in order as the signed-in member and requires one start and one end line for the read and no line naming a page.
  • A token that expires during a request is refreshed and the read retried. Success of the resend prints only the rows. If the resend fails too, stderr retains both the first expired request's failure and the refreshed request's actual failure; neither is replaced by a bare login hint. The ignored live journey `tests/database/refresh_refusal.rs::a_real_failed_resend_names_both_requests` qualifies this path only when the real database exhibits both failures, retaining the built candidate's exit and streams under `.build/database-retry/<revision>`. A healthy read cannot pass that journey.

Refusals and safe exits#

  • `oko database read requires --table <text>` and `oko database read takes a table name; got <text>` (exit 2); `oko database read scopes rows to the member's organization itself; drop org_id from --query`; `the shared database answered unreadable JSON for <path>: <error>`; the session refusals of `check`.

CLI reference#