Raw schema
{
"type": "object",
"properties": {
"collection": {
"type": "string",
"description": "Collection name, e.g. \"purchases\", \"tickets\", \"campaigns\""
},
"dimensions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Field name"
},
"alias": {
"type": "string",
"description": "Alias for the column in results"
}
},
"required": [
"field"
],
"additionalProperties": false
},
"description": "Fields to group by (SELECT dimensions). Omit for aggregate-only queries."
},
"metrics": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Field name to aggregate"
},
"operation": {
"type": "string",
"description": "Aggregation function. Known values: sum | count | avg | min | max | count_distinct | median | percentile | stddev | variance | date_diff"
},
"alias": {
"type": "string",
"description": "Alias for the aggregated column in results"
}
},
"required": [
"field",
"operation"
],
"additionalProperties": false
},
"description": "Aggregated metrics to compute (SUM, COUNT, etc.)"
},
"timeRange": {
"type": "object",
"properties": {
"start": {
"type": "string",
"description": "Start date in ISO 8601 format, e.g. \"2024-01-01\""
},
"end": {
"type": "string",
"description": "End date in ISO 8601 format, e.g. \"2024-12-31\""
},
"granularity": {
"type": "string",
"description": "Time bucket granularity (deprecated: use top-level timeGranularity)"
}
},
"required": [
"start",
"end"
],
"additionalProperties": false,
"description": "Time range filter with optional granularity for trend analysis"
},
"filters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Field name to filter on"
},
"operator": {
"type": "string",
"description": "Comparison operator. Known values: eq | neq | gt | gte | lt | lte | in | not_in | like | contains | not_contains | starts_with | ends_with | regex | between | is_null | is_not_null | is_true | is_false | array_contains | array_contains_any"
},
"value": {
"description": "Filter value; use array for \"in\" / \"not_in\" / \"between\" operators"
}
},
"required": [
"field",
"operator"
],
"additionalProperties": false
},
"description": "WHERE clause filters to apply before aggregation"
},
"having": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Aggregated field name"
},
"operator": {
"type": "string",
"description": "Comparison operator (e.g. \"gt\", \"gte\")"
},
"value": {
"description": "HAVING threshold value"
}
},
"required": [
"field",
"operator"
],
"additionalProperties": false
},
"description": "HAVING clause filters to apply after aggregation"
},
"sort": {
"anyOf": [
{
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Field to sort by"
},
"order": {
"type": "string",
"enum": [
"asc",
"desc"
],
"description": "Sort direction: asc | desc"
}
},
"required": [
"field",
"order"
],
"additionalProperties": false
},
{
"type": "array",
"items": {
"$ref": "#/properties/sort/anyOf/0"
},
"minItems": 1
}
],
"description": "Sort the result rows. Accepts a single { field, order } object or an array for multi-field sorting."
},
"limit": {
"type": "number",
"maximum": 1000,
"default": 100,
"description": "Maximum rows to return (max 1000, default 100)"
},
"compareDimensions": {
"type": "object",
"properties": {
"active": {
"type": "boolean",
"description": "Enable comparative analysis"
},
"dimensions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Dimension field name"
},
"value": {
"type": "string",
"description": "Dimension field value to compare"
},
"name": {
"type": "string",
"description": "Display name for the comparison group"
}
},
"required": [
"field",
"value",
"name"
],
"additionalProperties": false
},
"description": "Dimension values to compare against each other"
}
},
"required": [
"active",
"dimensions"
],
"additionalProperties": false,
"description": "Comparative dimension analysis configuration"
},
"distinct": {
"type": "boolean",
"description": "Add SELECT DISTINCT to deduplicate result rows (v3.19.0+)"
},
"dryRun": {
"type": "boolean",
"description": "Dry-run mode: estimate query cost without executing (v3.19.0+). Response includes estimatedBytes in metadata."
},
"timeGranularity": {
"type": "string",
"description": "Time granularity for bucketing (v3.19.0+). Known values: day | week | month | quarter | year | hour | minute | fiscalQuarter | fiscalYear"
},
"groupBy": {
"type": "array",
"items": {
"type": "string"
},
"description": "Calendar-based group-by fields (v3.19.0+). Known values: dayOfWeek | weekOfYear | hourOfDay | minuteOfHour | month | quarter | year"
},
"comparePeriods": {
"type": "object",
"properties": {
"active": {
"type": "boolean",
"description": "Enable period-over-period comparison"
},
"current": {
"type": "object",
"properties": {
"start": {
"type": "string",
"description": "ISO 8601 start date, e.g. \"2024-01-01\""
},
"end": {
"type": "string",
"description": "ISO 8601 end date, e.g. \"2024-12-31\""
}
},
"required": [
"start",
"end"
],
"additionalProperties": false,
"description": "The reference (current) time period"
},
"previous": {
"type": "object",
"properties": {
"start": {
"$ref": "#/properties/comparePeriods/properties/current/properties/start"
},
"end": {
"$ref": "#/properties/comparePeriods/properties/current/properties/end"
}
},
"required": [
"start",
"end"
],
"additionalProperties": false,
"description": "The baseline (previous) time period to compare against"
}
},
"required": [
"active",
"current",
"previous"
],
"additionalProperties": false,
"description": "Period-over-period comparison (YoY, MoM, etc.) โ v3.19.0+"
},
"ctes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name used to reference this CTE via the sourceTable field"
},
"collection": {
"type": "string",
"description": "Source collection for this CTE"
},
"dimensions": {
"type": "array",
"items": {
"$ref": "#/properties/dimensions/items"
},
"description": "Dimensions to select in the CTE"
},
"metrics": {
"type": "array",
"items": {
"$ref": "#/properties/metrics/items"
},
"description": "Metrics to compute in the CTE"
},
"filters": {
"type": "array",
"items": {
"$ref": "#/properties/filters/items"
},
"description": "Filters to apply in the CTE"
},
"timeRange": {
"$ref": "#/properties/timeRange",
"description": "Time range filter for the CTE"
},
"sort": {
"$ref": "#/properties/sort",
"description": "Sort order for the CTE"
},
"limit": {
"type": "number",
"maximum": 10000,
"description": "Row limit for the CTE"
}
},
"required": [
"name",
"collection"
],
"additionalProperties": false
},
"description": "CTE (Common Table Expression) sub-queries โ v3.19.0+"
},
"sourceTable": {
"type": "string",
"description": "CTE name to use as source instead of a raw collection โ v3.19.0+"
}
},
"required": [
"collection"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}