Skip to main content

mr query schema

List the tables saved SQL may read and their columns, for use as a reference when authoring query Text. The response is a single JSON object whose keys are table names and whose values are arrays of column name strings. The content tables (e.g. resources, notes, groups), their join tables and, on SQLite, their FTS tables appear; users, sessions, api_tokens and every other table query run cannot read are left out. A group-limited account, which cannot run saved SQL, gets 403; on PostgreSQL with -auth, a read-only role that fails the server's check gets 503.

Handy as a quick discovery tool before writing a new saved query.

Usage​

mr query schema

Examples​

Dump the full schema as JSON

mr query schema

List only the column names of the resources table

mr query schema --json | jq -r '.resources[]'

Flags​

This command has no local flags.

Inherited global flags​

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output​

Object mapping table name (string) to an array of column names (string[])

Exit Codes​

0 on success; 1 on any error

See Also​