Skip to main content

Saved queries

Saved queries are a way to save commonly used queries in MetricFlow. You can group metrics, dimensions, and filters that are logically related into a saved query.

To define a saved query, refer to the following specification:

ParameterDescriptionType
nameThe name of the metric.Required
descriptionThe description of the metric.Optional
query_paramsThe query parameters for the saved query: metrics, group_by, and where.Required

The following is an example of a saved query:

saved_queries:
name: p0_booking
description: Booking-related metrics that are of the highest priority.
query_params:
metrics:
- bookings
- instant_bookings
group_by:
- TimeDimension('metric_time', 'day')
- Dimension('listing__capacity_latest')
where:
- "{{ Dimension('listing__capacity_latest') }} > 3"

FAQs

  • All metrics in a saved query need to use the same dimensions in the group_by or where clauses.
0