Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add file names for clarity #5998

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions website/docs/docs/build/metricflow-time-spine.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Previously, you were required to create a model called `metricflow_time_spine` i

<Lightbox src="/img/time_spines.png" title="Time spine directory structure" />


<File name="models/_models.yml">

```yaml
models:
- name: time_spine_hourly
Expand All @@ -35,6 +36,7 @@ models:
- name: date_day
granularity: day # set granularity at column-level for standard_granularity_column
```
</File>

Now, break down the configuration above. It's pointing to a model called `time_spine_daily`. It sets the time spine configurations under the `time_spine` key. The `standard_granularity_column` is the lowest grain of the table, in this case, it's hourly. It needs to reference a column defined under the columns key, in this case, `date_hour`. Use the `standard_granularity_column` as the join key for the time spine table when joining tables in MetricFlow. Here, the granularity of the `standard_granularity_column` is set at the column level, in this case, `hour`.

Expand Down Expand Up @@ -83,6 +85,8 @@ and date_hour < dateadd(day, 30, current_timestamp())

<VersionBlock firstVersion="1.7">

<File name="metricflow_time_spine.sql">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiya @mirnawong1

I'm probably overthinking this but should the pic have two file names?

Kind Regards
Natalie
Screenshot 2024-09-02 at 15 24 11

```sql
{{
config(
Expand Down Expand Up @@ -111,15 +115,17 @@ select * from final
where date_day > dateadd(year, -4, current_timestamp())
and date_hour < dateadd(day, 30, current_timestamp())
```
</File>

</VersionBlock>

</File>

<VersionBlock lastVersion="1.6">

<File name="metricflow_time_spine.sql">

```sql
-- filename: metricflow_time_spine.sql
-- BigQuery supports DATE() instead of TO_DATE(). Use this model if you're using BigQuery
{{config(materialized='table')}}
with days as (
Expand All @@ -142,13 +148,15 @@ from final
where date_day > dateadd(year, -4, current_timestamp())
and date_hour < dateadd(day, 30, current_timestamp())
```
</File>

</VersionBlock>

<VersionBlock firstVersion="1.7">

<File name="metricflow_time_spine.sql">

```sql
-- filename: metricflow_time_spine.sql
-- BigQuery supports DATE() instead of TO_DATE(). Use this model if you're using BigQuery
{{config(materialized='table')}}
with days as (
Expand All @@ -171,14 +179,14 @@ from final
where date_day > dateadd(year, -4, current_timestamp())
and date_hour < dateadd(day, 30, current_timestamp())
```
</File>

</VersionBlock>

## Hourly time spine
<File name='time_spine_hourly.sql'>

```sql
-- filename: metricflow_time_spine_hour.sql
{{
config(
materialized = 'table',
Expand Down
Loading