Skip to main content

mr query run-by-name

Execute a saved query by its unique Name instead of its numeric ID. Same semantics as query run: read-only handle, 400 on SQL errors, 404 when the name does not resolve. Useful in scripts where the ID is not known ahead of time but the name is a stable contract.

Renaming a query via query edit-name invalidates callers that pointed at the old name, so prefer query run <id> for long-running integrations.

Usage

mr query run-by-name

Examples

Run by name

mr query run-by-name --name "count-resources"

Run by name and extract the count column

mr query run-by-name --name "count-resources" --json | jq '.[0].n'

Flags

FlagTypeDefaultDescription
--namestring``Query name (required) (required)

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

Array of row objects; each object's keys are the query's selected column names

Exit Codes

0 on success; 1 on any error

See Also