omni-query

작성자: exploreomni

Omni Analytics의 시맨틱 레이어에 대해 REST API를 사용하여 쿼리를 실행하고, 결과를 해석하며, 다단계 분석을 위해 쿼리를 연결합니다. 이 스킬은 다음 상황에서 사용하세요…

npx skills add https://github.com/exploreomni/omni-claude-skills --skill omni-query

Omni Query

Run queries against Omni's semantic layer via the REST API. Omni translates field selections into optimized SQL — you specify what you want (dimensions, measures, filters), not how to get it.

Tip: Use omni-model-explorer first if you don't know the available topics and fields.

Prerequisites

export OMNI_BASE_URL="https://yourorg.omniapp.co"
export OMNI_API_KEY="your-api-key"

You also need a model ID and knowledge of available topics and fields.

API Discovery

When unsure whether an endpoint or parameter exists, fetch the OpenAPI spec:

curl -L "$OMNI_BASE_URL/openapi.json" \
  -H "Authorization: Bearer $OMNI_API_KEY"

Use this to verify endpoints, available parameters, and request/response schemas before making calls.

Running a Query

Basic Query

curl -L -X POST "$OMNI_BASE_URL/api/v1/query/run" \
  -H "Authorization: Bearer $OMNI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "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"
    }
  }'

Query Parameters

ParameterRequiredDescription
modelIdYesUUID of the Omni model
tableYesBase view name (the FROM clause)
fieldsYesArray of view.field_name references
join_paths_from_topic_nameRecommendedTopic for join resolution
limitNoRow limit (default 1000, max 50000, null for unlimited)
sortsNoArray of sort objects
filtersNoFilter object
pivotsNoArray of field names to pivot on

Field Naming

Fields use view_name.field_name. Date fields support timeframe brackets:

users.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

"sorts": [
  { "column_name": "order_items.total_revenue", "sort_descending": true }
]

Filters

"filters": {
  "order_items.created_at": "last 90 days",
  "order_items.status": "complete",
  "users.state": "California,New York"
}

Expressions: "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". See references/filter-expressions.md for the complete expression syntax reference.

Pivots

{
  "query": {
    "fields": ["order_items.created_at[month]", "order_items.status", "order_items.count"],
    "pivots": ["order_items.status"],
    "join_paths_from_topic_name": "order_items"
  }
}

Handling Results

Default response: base64-encoded Apache Arrow table. Arrow results are binary — you cannot parse individual row data from the raw response. To verify a query returned data, check summary.row_count in the response.

For human-readable results, request CSV instead:

{ "query": { ... }, "resultType": "csv" }

Decoding Arrow Results

import base64, pyarrow as pa
arrow_bytes = base64.b64decode(response["data"])
reader = pa.ipc.open_stream(arrow_bytes)
df = reader.read_all().to_pandas()

Long-Running Queries

If the response includes remaining_job_ids, poll until complete:

curl -L -X POST "$OMNI_BASE_URL/api/v1/query/wait" \
  -H "Authorization: Bearer $OMNI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "jobIds": ["job-id-1", "job-id-2"] }'

Running Queries from Dashboards

Extract and re-run queries powering existing dashboards:

# Get all queries from a dashboard
curl -L "$OMNI_BASE_URL/api/v1/documents/{dashboardId}/queries" \
  -H "Authorization: Bearer $OMNI_API_KEY"

# Run as a specific user
{ "query": { ... }, "userId": "user-uuid-here" }

# Cache policy (valid values: Standard, SkipRequery, SkipCache)
{ "query": { ... }, "cache": "SkipCache" }

Multi-Step Analysis Pattern

For complex analysis, chain queries:

  1. Broad query — understand the shape of the data
  2. Inspect results — identify interesting segments or patterns
  3. Focused follow-ups — filter based on findings
  4. Synthesize — combine results into a narrative

Common Query Patterns

Time Series: fields + date dimension + ascending sort + date filter

Top N: fields + metric + descending sort + limit

Aggregation with Breakdown: multiple dimensions + multiple measures + descending sort by key metric

Known Bugs

  • IS_NOT_NULL filter generates IS NULL (reported Omni bug) — workaround: invert the filter logic or use the base view to apply the filter differently.
  • Boolean filters may be silently dropped when a pivots array is present — if boolean filters aren't applying, remove the pivot and test again.

Linking to Results

Queries are ephemeral — there is no persistent URL for a query result. To give the user a shareable link:

  • For existing dashboards: {OMNI_BASE_URL}/dashboards/{identifier} (the identifier comes from the document API response)
  • For new analysis: Create a document via omni-content-builder with the query as a queryPresentation, then share {OMNI_BASE_URL}/dashboards/{identifier}

Docs Reference

Related Skills

  • omni-model-explorer — discover fields and topics before querying
  • omni-content-explorer — find dashboards whose queries you can extract
  • omni-content-builder — turn query results into dashboards

exploreomni의 다른 스킬

omni-admin
exploreomni
Omni Analytics 인스턴스를 관리합니다 — Omni CLI를 통해 연결, 사용자, 그룹, 사용자 속성, 권한, 일정 및 스키마 새로고침을 관리합니다. 사용…
official
omni-ai-eval
exploreomni
Omni AI 쿼리 생성 정확도를 평가하려면 Omni CLI를 통해 테스트 프롬프트를 실행하고, 생성된 쿼리 JSON을 예상 결과와 비교한 후 점수를 매깁니다…
official
omni-ai-optimizer
exploreomni
Omni Analytics 모델을 Blobby, Omni Agent에 맞게 최적화하세요 — ai_context, ai_fields, sample_queries를 구성하고 AI 전용 주제 확장을 생성하세요. 사용…
official
omni-content-builder
exploreomni
Omni Analytics 문서와 대시보드를 프로그래밍 방식으로 생성, 업데이트 및 관리합니다 — 문서 수명 주기, 타일, 시각화, 필터, 레이아웃 — 다음을 사용하여…
official
omni-content-explorer
exploreomni
Omni Analytics에서 대시보드, 워크북, 폴더, 레이블 등 콘텐츠를 찾고, 탐색하고, 정리할 수 있습니다. Omni CLI를 사용하세요. 누군가 원할 때마다 이 스킬을 사용하세요…
official
omni-embed
exploreomni
Omni Analytics 대시보드를 외부 애플리케이션에 임베드 — URL 서명, 사용자 정의 테마, iframe 이벤트, 엔터티 워크스페이스 및 권한 인식 콘텐츠 — 사용…
official
omni-model-builder
exploreomni
Omni Analytics 시맨틱 모델 정의(뷰, 토픽, 차원, 측정값, 관계 및 쿼리 뷰)를 YAML을 통해 생성 및 편집합니다.
official
omni-model-explorer
exploreomni
Omni CLI를 사용하여 Omni Analytics 모델, 토픽, 뷰, 필드, 차원, 측정값 및 관계를 검색하고 검사합니다. 누군가가...할 때마다 이 스킬을 사용하세요.
official