Loading...
Loading...
Run queries against Omni Analytics' semantic layer using the Omni CLI, interpret results, and chain queries for multi-step analysis. Use this skill whenever someone wants to query data through Omni, run a report, get metrics, pull numbers, analyze data, ask "how many", "what's the trend", "show me the data", retrieve dashboard query results, or perform any data retrieval through Omni's query engine. Also use when someone wants to programmatically extract data from an existing Omni dashboard or workbook.
npx skill4agent add exploreomni/omni-agent-skills omni-queryTip: Usefirst if you don't know the available topics and fields.omni-model-explorer
# Verify the Omni CLI is installed — if not, ask the user to install it
# See: https://github.com/exploreomni/cli#readme
command -v omni >/dev/null || echo "ERROR: Omni CLI is not installed."# Show available profiles and select the appropriate one
omni config show
# If multiple profiles exist, ask the user which to use, then switch:
omni config use <profile-name>omni query --help # List query operations
omni query run --help # Show flags for running a query
omni ai --help # AI-powered query generationTip: Useto force structured output for programmatic parsing, or-o jsonfor readable tables. The default is-o human(human in a TTY, JSON when piped).auto
omni query run --body '{
"query": {
"modelId": "your-model-id",
"table": "order_items",
"fields": [
"order_items.created_at[month]",
"order_items.total_revenue"
],
"limit": 100,
"join_paths_from_topic_name": "order_items"
}
}'| Parameter | Required | Description |
|---|---|---|
| Yes | UUID of the Omni model |
| Yes | Base view name (the |
| Yes | Array of |
| Recommended | Topic for join resolution |
| No | Row limit (default 1000, max 50000, |
| No | Array of sort objects |
| No | Filter object |
| No | Array of field names to pivot on |
view_name.field_nameusers.created_at[date] — Daily
users.created_at[week] — Weekly
users.created_at[month] — Monthly
users.created_at[quarter] — Quarterly
users.created_at[year] — Yearly"sorts": [
{ "column_name": "order_items.total_revenue", "sort_descending": true }
]"filters": {
"order_items.created_at": "last 90 days",
"order_items.status": "complete",
"users.state": "California,New York"
}"last 90 days""this quarter""2024-01-01 to 2024-12-31""not California""null""not null"">100""between 10 and 100""contains sales""starts with A"{
"query": {
"fields": ["order_items.created_at[month]", "order_items.status", "order_items.count"],
"pivots": ["order_items.status"],
"join_paths_from_topic_name": "order_items"
}
}summary.row_count{ "query": { ... }, "resultType": "csv" }errorremaining_job_idsomni query waitsummary.row_count == 0summary.row_countlimitnullomni query run --body '{
"query": { ... },
"resultType": "csv"
}'# Run the same query without filters
omni query run --body '{ "query": { ... (no filters) ... }, "resultType": "csv" }'
# Compare row counts — filtered should be <= unfiltered| Check | How | When |
|---|---|---|
| No error in response | Check for | Every query |
| Data was returned | | Every query |
| Results not truncated | | When completeness matters |
| Columns are correct | CSV column headers match requested fields | When building dashboards or reports |
| Values are reasonable | Spot-check CSV output | When presenting to users |
| Filters are applied | Compare filtered vs unfiltered row counts | When using filters |
| Long-running query completed | No | Queries on large tables |
import base64, pyarrow as pa
arrow_bytes = base64.b64decode(response["data"])
reader = pa.ipc.open_stream(arrow_bytes)
df = reader.read_all().to_pandas()remaining_job_idsomni query wait --jobids job-id-1,job-id-2# Get all queries from a dashboard
omni documents get-queries <dashboardId>
# Run as a specific user
omni query run --body '{ "query": { ... }, "userId": "user-uuid-here" }'
# Cache policy (valid values: Standard, SkipRequery, SkipCache)
omni query run --body '{ "query": { ... }, "cache": "SkipCache" }'--run-query false# Just generate the query JSON (no execution)
omni ai generate-query your-model-id "Show me revenue by month" --run-query false{
"query": {
"fields": ["order_items.created_at[month]", "order_items.total_revenue"],
"table": "order_items",
"filters": {},
"sorts": [{"column_name": "order_items.created_at[month]", "sort_descending": false}],
"limit": 500
},
"topic": "order_items",
"error": null
}# Generate and execute in one call
omni ai generate-query your-model-id "Top 10 customers by lifetime spend"--branch-id--current-topic-nameomni ai pick-topic your-model-id "How many users signed up last month?"# 1. Submit a job
omni ai job-submit your-model-id "Analyze revenue trends and identify our fastest growing product category"
# → returns { "jobId": "job-uuid", "conversationId": "conv-uuid" }
# 2. Poll for completion (QUEUED → EXECUTING → COMPLETE)
omni ai job-status <jobId>
# 3. Get the result
omni ai job-result <jobId>actionstype: "generate_query"resultSummaryomni ai job-cancel <jobId>omni ai job-visualization <jobId>| Approach | Best For |
|---|---|
| You know exactly which fields, filters, and sorts you need |
| Translating a natural language question into a single query |
| Complex questions that may need multiple queries or multi-step reasoning |
IS_NOT_NULLIS NULLpivots{OMNI_BASE_URL}/dashboards/{identifier}identifieromni-content-builderqueryPresentation{OMNI_BASE_URL}/dashboards/{identifier}