Loading...
Loading...
Run queries against a Cube deployment's semantic layer and interpret the results, from the terminal. Use whenever someone wants numbers out of Cube — pull a metric, check a total, compare periods, verify that a measure returns what it should, sanity-check a model change. Triggers on "how many", "what's the total", "show me revenue by month", "did that measure work", "what's our MoM growth", "pull the numbers for", and any request to verify a model change against real data. To find out what is queryable first use cube-explore-model; to change the model use cube-build-model; to save a result as a report or dashboard use cube-build-content.
npx skill4agent add cube-js/cube-agent-skills cube-run-querycube apicommand -v cube >/dev/null || echo "Cube CLI not installed: curl -fsSL https://raw.githubusercontent.com/cube-js/cube/master/install-cli.sh | sh"
cube whoami || echo "Not authenticated. Interactive: cube login. Headless: set CUBE_API_URL + CUBE_API_KEY."
cube context listjqcurlDEPLOYMENT=<id>
URL=$(cube deployments get "$DEPLOYMENT" --json | jq -r .deploymentUrl)
TOKEN=$(cube deployments token "$DEPLOYMENT")cube deployments token--jsoncube meta --selectors '[{"type":"cube","deploymentId":'"$DEPLOYMENT"',"environment":"production"}]'Cube.memberView.membercube metacurl -s "$URL/cubejs-api/v1/load" \
-H "Authorization: $TOKEN" \
-H 'Content-Type: application/json' \
-d '{"query":{
"measures":["Orders.count","Orders.totalRevenue"],
"dimensions":["Orders.status"],
"timeDimensions":[{"dimension":"Orders.createdAt","granularity":"month","dateRange":"Last 6 months"}],
"limit":100
}}' | jqmeasuresdimensionstimeDimensionsdimensiongranularitydayweekmonthdateRange"Last 30 days"["2026-01-01","2026-06-30"]filters[{"member":"Orders.status","operator":"equals","values":["paid"]}]orderlimitdataannotationannotationdatacube-build-model| Symptom | Cause |
|---|---|
| The deployment has never finished a build; check |
| 401 from the load endpoint | Token expired — they are short-lived, just mint another |
| Wrong name or not exposed in that view — re-check |
| Query hangs | A large uncached query; report it rather than silently retrying |