Query
API contracts for running analytical requests and working with their outputs.
Vulcan supports multiple query interfaces over the same Data Product. Choose the interface that matches how much abstraction your application needs.
Submit queries and fetch results. Raw SQL, Semantic REST, Semantic SQL, and Metric queries share the same async submit → poll → fetch pattern. See GraphQL for the Semantic GraphQL interface.
Async query submissions return a statement id. Poll it through Query Result. The Postman collection saves the id as statement_id automatically.
Which Query Type Should I Use?
Raw SQL
You know the physical data model and need direct SELECT control.
Semantic REST
Your application builds structured requests from governed measures and dimensions.
Semantic SQL
You prefer SQL syntax while retaining semantic measures and dimensions.
Semantic GraphQL
Your application uses GraphQL and needs an inline response.
Metric endpoints
You want to query one predefined metric with minimal request construction.
Asynchronous query lifecycle
Submit query
↓ 202 Accepted + statement id
Poll GET /query/statement/{id}
↓ SUCCESS
Fetch GET /query/statement/{id}/resultStatement status: ACCEPTED → QUEUED → IN_PROGRESS → SUCCESS. A statement can also become FAILED or CANCELLED.
202 Accepted means the request was accepted, not that execution completed. Poll until the statement reaches SUCCESS, FAILED, or CANCELLED.
Execution Strategies (Cache Behavior)
EXECUTE
A new warehouse query was queued.
AWAIT_PRIMARY
An identical query is already running; this request follows that execution.
REUSE_RESULT
A compatible successful result already exists and can be reused.
Semantic GraphQL normally waits and returns data inline. If processing exceeds its polling window, it can return 202 and ask the caller to retry.
Query Result
Poll statement status and retrieve results after any async query submission.
Poll statement status
API endpoint: GET /api/v1/query/statement/{id}
Description: Poll the status and metadata of an asynchronous query. Use the Location header or statement id returned by a submission endpoint. Poll until status is SUCCESS, FAILED, or CANCELLED. Check the error field on failure. An Is-Stale: true header means dependencies are not current.
Path params:
id
Statement identifier returned by a query submission.
cURL:
Example response:
Returns: 200 OK with statement status, query type, execution strategy, timestamps, error information when failed, staleness information, and result links when available. 404 Not Found means the statement does not exist.
Fetch result data
API endpoint: GET /api/v1/query/statement/{id}/result
Description: Fetch result once status is SUCCESS. Parquet returns a 307 redirect to a presigned download URL.
Path params:
id
Statement ID returned from a query submission endpoint.
Key query params:
format
parquet
Response format: parquet, json, yaml, or csv.
limit
None
Maximum rows to return for text formats. Must be 0 or greater.
offset
0
Number of rows to skip for text formats.
columns
None
Comma-separated column names to include for text formats.
cURL:
Returns: For json: object with cols[], rows[][], types[], row_count, size_bytes, is_stale, and _links. For parquet: HTTP 307 redirect to presigned binary download URL.
Text formats return 200 OK. Parquet returns 307 Temporary Redirect with a presigned URL in Location; clients must follow redirects. 400 Bad Request indicates an invalid column projection, 404 Not Found means the result is unavailable, and 406 Not Acceptable indicates an unsupported format.
For result sets over 50,000 records, see the pagination recipe in Consume: submit with limit/offset/order in the request body and page through with a constant order.
Submit raw SQL
API endpoint: POST /api/v1/query/statement
Description: Submit a read-only SQL query against physical models in the active environment. Use this when semantic interfaces do not support the required analysis and the caller understands the physical schema. Only SELECT queries are accepted. Access policies apply before execution.
Key query params: retry_on_recent_failure (default false): retry even if an identical query failed recently, instead of getting the cached failure back.
Request body:
cURL:
Returns: 202 Accepted with the statement ID and a Location header pointing to its status endpoint. Invalid, unsafe, or unauthorized SQL returns 400 Bad Request. Invalid request bodies return 422 Unprocessable Entity.
Semantic REST
Submit semantic REST queries (measures, dimensions, filters). See Query Result above for submit, poll, and fetch.
Submit semantic REST query
API endpoint: POST /api/v1/query/semantic/rest
Description: Query governed measures and dimensions using a structured JSON body. This is the recommended interface for query builders and BI-style applications that should not construct warehouse SQL.
Key query params:
retry_on_recent_failure(defaultfalse): retry even if an identical query failed recently.transpile_only(defaultfalse, truthy values:true): return the generated warehouse SQL instead of executing the query; no statement is created. See the transpile-only recipe in Consume.
Request body:
cURL:
Returns: Normally 202 Accepted with a statement id, status, execution strategy, staleness information, and links. With transpile_only=true, returns 200 OK with generated SQL and creates no statement. Invalid semantic requests return 400 Bad Request; transpiler failures return 502 or 503.
Semantic SQL
Submit SQL that references semantic measures and dimensions. See Query Result above for submit, poll, and fetch.
Submit semantic SQL
API endpoint: POST /api/v1/query/semantic/sql
Description: Write SQL against semantic model fields and governed measures. Use this when analysts prefer SQL but should remain on the semantic contract instead of physical tables.
Key query params:
retry_on_recent_failure(defaultfalse): retry even if an identical query failed recently.transpile_only(defaultfalse, truthy values:true): return the generated warehouse SQL instead of executing the query; no statement is created. See the transpile-only recipe in Consume.
Request body:
cURL:
Returns: 202 Accepted with a statement reference, or 200 OK with compiled warehouse SQL when transpile_only=true. Invalid semantic SQL returns 400 Bad Request; transpiler failures return 502 or 503.
Semantic Metrics
Shorthand for named metric queries. Translates to semantic REST internally. See Query Result above for submit, poll, and fetch.
Query a named metric (simple)
API endpoint: GET /api/v1/query/metric/{metric_name}
Description: Simplest way to query a metric. Discover metric names from GET /metadata/semantic. Slice by dimensions or time granularity via query params.
Path params:
metric_name
Metric name from catalog metadata, for example CUSTOMER_GROWTH.
Key query params:
dimensions
None
Comma-separated dimension aliases defined on the metric.
granularity
Metric default
Time-series granularity: second, minute, hour, day, week, month, quarter, or year.
timezone
UTC
Timezone for time dimensions.
limit
10000
Maximum rows to return. Range: 1–50000.
offset
0
Number of rows to skip.
cURL:
Returns: 202 Accepted with a statement reference. Returns 404 Not Found when the metric does not exist, 400 Bad Request for an invalid metric query, and 502 Bad Gateway for a transpiler failure.
Query a named metric (with filters)
API endpoint: POST /api/v1/query/metric/{metric_name}
Description: Query one predefined metric using a request body. Use this variant when dimensions, ordering, or compound filters are required.
Path params:
metric_name
Metric name from catalog metadata, for example CUSTOMER_GROWTH.
Request body:
cURL:
Returns: 202 Accepted with a statement reference. Error behavior matches the GET metric endpoint.
Usage Metrics
Query API usage analytics for the Data Product. Not part of the async statement execution flow.
Query usage analytics
API endpoint: GET /api/v1/query/usage-metrics
Description: Weekly usage stats: active users, new users, total queries, median execution time, and cache hit savings. Defaults to the current week.
Key query params:
week_start
Current week
Monday of the target week in UTC, formatted as YYYY-MM-DD.
cURL:
Returns: 200 OK with active users, new users, total queries, median execution time, and cache-reuse savings for the requested week. Returns 400 Bad Request for an invalid date and 501 Not Implemented when the configured state backend does not support usage metrics.
Last updated
Was this helpful?