nevent_analytics_query
Query event marketing analytics. Supports dimensions, metrics, time ranges, and filters across campaigns, purchases, users, and more. MANDATORY RULES: (1) ALWAYS call nevent_analytics_table_schema BEFORE querying to discover exact field names. NEVER guess field names. (2) For BOOLEAN fields, use operator "is_true" or "is_false". NEVER use "eq" with string "true"/"false". (3) For enum fields (state, status), check the field description for valid values. Common values: purchases.state = SUCCEEDED|COMPLETE|PENDING|FAILED; campaigns.status = EXECUTED|DRAFT|PAUSED|STOPPED.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ctes | No | CTE (Common Table Expression) sub-queries — v3.19.0+ | |
| sort | No | Sort the result rows. Accepts a single { field, order } object or an array for multi-field sorting. | |
| limit | No | Maximum rows to return (max 1000, default 100) | |
| dryRun | No | Dry-run mode: estimate query cost without executing (v3.19.0+). Response includes estimatedBytes in metadata. | |
| having | No | HAVING clause filters to apply after aggregation | |
| filters | No | WHERE clause filters to apply before aggregation | |
| groupBy | No | Calendar-based group-by fields (v3.19.0+). Known values: dayOfWeek | weekOfYear | hourOfDay | minuteOfHour | month | quarter | year | |
| metrics | No | Aggregated metrics to compute (SUM, COUNT, etc.) | |
| distinct | No | Add SELECT DISTINCT to deduplicate result rows (v3.19.0+) | |
| timeRange | No | Time range filter with optional granularity for trend analysis | |
| collection | Yes | Collection name, e.g. "purchases", "tickets", "campaigns" | |
| dimensions | No | Fields to group by (SELECT dimensions). Omit for aggregate-only queries. | |
| sourceTable | No | CTE name to use as source instead of a raw collection — v3.19.0+ | |
| comparePeriods | No | Period-over-period comparison (YoY, MoM, etc.) — v3.19.0+ | |
| timeGranularity | No | Time granularity for bucketing (v3.19.0+). Known values: day | week | month | quarter | year | hour | minute | fiscalQuarter | fiscalYear | |
| compareDimensions | No | Comparative dimension analysis configuration |