Skip to main content

mr mrql run

Execute a saved MRQL query by name or numeric ID. The argument is tried as an ID first and then as a name, so a name that happens to be numeric can still be resolved. Returns the same shape as a one-off mrql call: either a standard result with an entityType plus the matching entity arrays, or — for GROUP BY queries — a grouped result with mode (aggregated or bucketed) and rows / groups.

Pagination and shaping flags (--limit, --buckets, --offset, plus the global --page) apply to the stored query exactly as they would to an inline mrql invocation. Pass --render to request server-side template rendering via the CustomMRQLResult template. A missing ID or name returns HTTP 404.

This is distinct from query run, which executes SQL-backed Query records rather than MRQL DSL expressions.

Usage

mr mrql run <name-or-id>

Positional arguments:

  • <name-or-id>

Examples

Run a saved query by ID

mr mrql run 42

Run by name with bucketed GROUP BY pagination

mr mrql run "resources-by-type" --buckets 5

Run and extract result ids with jq

mr mrql run "recent-photos" --json | jq -r '.resources[].ID'

Flags

FlagTypeDefaultDescription
--limitint0Items per bucket for GROUP BY, or total items for regular queries
--bucketsint0Groups per page for bucketed GROUP BY queries
--offsetint0Bucket offset for cursor-based GROUP BY pagination
--renderboolfalseRequest server-side template rendering via CustomMRQLResult

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

MRQL result object with entityType (string) and resources/notes/groups arrays, or a grouped result with mode + rows/groups for GROUP BY queries

Exit Codes

0 on success; 1 on any error

See Also