Skip to content

Commit

Permalink
Update saved query documentation for MetricFlow release (#4469)
Browse files Browse the repository at this point in the history
## What are you changing in this pull request and why?
With the release of MetricFlow 0.203.0 and dbt-metricflow 0.4.0 we now
have support for saved queries.

This commit removes the "coming soon" marker and updates the spec to
match the final release version.

## Checklist
- [x] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
and [About
versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
so my content adheres to these guidelines.
- [x] Add a checklist item for anything that needs to happen before this
PR is merged, such as "needs technical review" or "change base branch."
  • Loading branch information
Jstein77 committed Nov 14, 2023
2 parents 185e977 + 3f9863d commit 416f2c7
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions website/docs/docs/build/saved-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ sidebar_label: "Saved queries"
tags: [Metrics, Semantic Layer]
---

:::info Saved queries coming soon
Saved queries isn't currently available in MetricFlow but support is coming soon.
:::

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:
Expand All @@ -18,24 +14,23 @@ To define a saved query, refer to the following specification:
| --------- | ----------- | ---- |
| `name` | The name of the metric. | Required |
| `description` | The description of the metric. | Optional |
| `metrics` | The metrics included in the saved query. | Required |
| `group_bys` | The value displayed in downstream tools. | Required |
| `where` | Filter applied to the query. | Optional |
| `query_params` | The query parameters for the saved query: `metrics`, `group_by`, and `where`. | Required |

The following is an example of a saved query:

```yaml
saved_query:
name: p0_booking
description: Booking-related metrics that are of the highest priority.
metrics:
- bookings
- instant_bookings
group_bys:
- TimeDimension('metric_time', 'day')
- Dimension('listing__capacity_latest')
where:
- "{{ Dimension('listing__capacity_latest') }} > 3"
query_params:
metrics:
- bookings
- instant_bookings
group_bys:
- TimeDimension('metric_time', 'day')
- Dimension('listing__capacity_latest')
where:
- "{{ Dimension('listing__capacity_latest') }} > 3"
```
### FAQs
Expand Down

0 comments on commit 416f2c7

Please sign in to comment.