gtme query

read-only SQL against the ledger

What you'll learn

You're about to type gtme query and want its forms and its flags.

  • every form of gtme query and what each does
  • each flag and what it changes
  • where the docs use it

read-only SQL against the ledger; --save stores it as a named segment.

Forms

gtme query "SQL" [--save NAME] [--name NAME] [--list] [--format ndjson|table|csv] [--limit N]

Flags

FlagTakesWhat it does
--saveNAME--save stores it as a named segment.
--nameNAMESee the form.
--listnothingSee the form.
--format`ndjsontable
--limitNSee the form.

It exits with one of the exit codes every verb shares.

Example

From Your CSV:

gtme query "SELECT i.identity_key, e.detail ->> 'reason' AS reason
  FROM step_events e JOIN identities i ON i.id = e.identity_id
  WHERE e.step_id = 'fit' AND e.event = 'done' AND e.detail ->> 'pass' = 0"

Used in

  • The ledger: Read-only SQL against the ledger's views
  • Identity keys: Read-only SQL against the identities and relations tables
  • Groups and segments: Every gtme query flag, including --save, --name, and --list
  • Agent-operable by design: Read-only SQL against the ledger, with rows on stdout
  • Launch: Every flag of the command the ledger check uses
  • Report: Read-only SQL against the ledger, used for the check and the monthly total
  • Interrogate: Read-only SQL, used for a field's history and a referent lookup
  • Top up: Every flag of the command the proof queries use
  • Segment: Every gtme query flag, including --save, --name, --list, and --format
  • Traverse a relation: Read-only SQL against the ledger, used to check the relations