Skip to content

Commit

Permalink
Merge branch 'current' into nfiann-singulartests
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Oct 1, 2024
2 parents 1a39a15 + 2202b91 commit 06dddbf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
10 changes: 7 additions & 3 deletions website/docs/docs/build/metricflow-time-spine.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ MetricFlow requires you to define a time-spine table as a model-level configurat
To see the generated SQL for the metric and dimension types that use time-spine joins, refer to the respective documentation or add the `compile=True` flag when querying the Semantic Layer to return the compiled SQL.

## Configuring time-spine in YAML

- The time spine is a special model that tells dbt and MetricFlow how to use specific columns by defining their properties.
- The [`models` key](/reference/model-properties) for the time spine must be in your `models/` directory.
- You only need to configure time-spine models that the Semantic Layer should recognize.
- At a minimum, define a time-spine table for a daily grain.
- You can optionally define a time-spine table for a different granularity, like hourly.
- Note that if you don’t have a date or calendar model in your project, you'll need to create one.
- Note that if you don’t have a date or calendar model in your project, you'll need to create one.

- If you're looking to specify the grain of a time dimension so that MetricFlow can transform the underlying column to the required granularity, refer to the [Time granularity documentation](/docs/build/dimensions?dimension=time_gran)

If you already have a date dimension or time-spine table in your dbt project, you can point MetricFlow to this table by updating the `model` configuration to use this table in the Semantic Layer. This is a model-level configuration that tells dbt to use the model for time range joins in the Semantic Layer.
Expand All @@ -40,7 +44,7 @@ If you don’t have a date dimension table, you can still create one by using th
<File name="models/_models.yml">

```yaml
models:
[models:](/reference/model-properties)
- name: time_spine_hourly
time_spine:
standard_granularity_column: date_hour # column for the standard grain of your table
Expand All @@ -56,7 +60,7 @@ models:
```
</File>
For an example project, refer to our [Jaffle shop](https://github.com/dbt-labs/jaffle-sl-template/blob/main/models/marts/_models.yml) example.
For an example project, refer to our [Jaffle shop](https://github.com/dbt-labs/jaffle-sl-template/blob/main/models/marts/_models.yml) example. Note that the [`models` key](/reference/model-properties) in the time spine configuration must be placed in your `models/` directory.

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
7 changes: 5 additions & 2 deletions website/docs/docs/cloud/about-cloud-develop-defer.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ The dbt Cloud CLI offers additional flexibility by letting you choose the source
<File name="dbt_cloud.yml">

```yml
defer-env-id: '123456'
context:
active-host: ...
active-project: ...
defer-env-id: '123456'
```
</File>
Expand All @@ -60,7 +63,7 @@ defer-env-id: '123456'
<File name="dbt_project.yml">
```yml
dbt_cloud:
dbt-cloud:
defer-env-id: '123456'
```
Expand Down
8 changes: 2 additions & 6 deletions website/docs/reference/model-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
title: Model properties
---

Models properties can be declared in `.yml` files in your `models/` directory (as defined by the [`model-paths` config](/reference/project-configs/model-paths)).
Models properties can be declared in `.yml` files in your `models/` directory (as defined by the [`model-paths` config](/reference/project-configs/model-paths)).

You can name these files `whatever_you_want.yml`, and nest them arbitrarily deeply in subfolders within the `models/` directory.
You can name these files `whatever_you_want.yml`, and nest them arbitrarily deeply in subfolders within the `models/` directory. The [MetricFlow time spine](/docs/build/metricflow-time-spine) is a model property that tells dbt and MetricFlow how to use specific columns by defining their properties.

<File name='models/<filename>.yml'>

Expand Down Expand Up @@ -74,7 +74,3 @@ models:

</File>

<!---
FAQs
- Do I need to declare every column for it to render in documentation?
--->

0 comments on commit 06dddbf

Please sign in to comment.