Skip to content

Commit

Permalink
add meta
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Nov 6, 2024
1 parent 0cf7dc2 commit 3571c0f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
7 changes: 7 additions & 0 deletions website/docs/docs/build/dimensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ All dimensions require a `name`, `type`, and can optionally include an `expr` pa
| `description` | A clear description of the dimension | Optional |
| `expr` | Defines the underlying column or SQL query for a dimension. If no `expr` is specified, MetricFlow will use the column with the same name as the group. You can use the column name itself to input a SQL expression. | Optional |
| `label` | A recommended string that defines the display value in downstream tools. Accepts plain text, spaces, and quotes (such as `orders_total` or `"orders_total"`). | Optional |
| `meta` | Use the [`meta` field](/reference/resource-configs/meta) to set metadata for a resource and organize resources. Accepts plain text, spaces, and quotes (such as `orders_total` or `"orders_total"`). | Optional |

Refer to the following for the complete specification for dimensions:

Expand Down Expand Up @@ -59,6 +60,8 @@ semantic_models:
type_params:
time_granularity: day
label: "Date of transaction" # Recommend adding a label to provide more context to users consuming the data
meta:
data_owner: "Finance team"
expr: ts
- name: is_bulk
type: categorical
Expand Down Expand Up @@ -106,6 +109,8 @@ dimensions:
- name: is_bulk_transaction
type: categorical
expr: case when quantity > 10 then true else false end
meta:
usage: "Filter to identify bulk transactions, like where quantity > 10."
```

## Time
Expand Down Expand Up @@ -136,6 +141,8 @@ dimensions:
type: time
label: "Date of creation"
expr: ts_created # ts_created is the underlying column name from the table
meta:
notes: "Only valid for orders from 2022 onward"
is_partition: True
type_params:
time_granularity: day
Expand Down
1 change: 1 addition & 0 deletions website/docs/docs/dbt-versions/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Release notes are grouped by month for both multi-tenant and virtual private clo
- Improved handling of queries when multiple tables are selected in a data source.
- Fixed a bug when an IN filter contained a lot of values.
- Better error messaging for queries that can't be parsed correctly.
- **New**: [Dimensions](/reference/resource-configs/meta) now support the meta config property in dbt Cloud Versionless ??? or v1.9+??. You can add metadata to your dimensions to provide additional context and information about the dimension. Refer to [meta](/reference/resource-configs/meta) for more information.

## October 2024
<Expandable alt_header="Coalesce 2024 announcements">
Expand Down
52 changes: 52 additions & 0 deletions website/docs/reference/resource-configs/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ hide_table_of_contents: true
{ label: 'Semantic Models', value: 'semantic models', },
{ label: 'Metrics', value: 'metrics', },
{ label: 'Saved queries', value: 'saved queries', },
{ label: 'Dimensions', value: 'dimensions', },
]
}>
<TabItem value="models">
Expand Down Expand Up @@ -250,6 +251,22 @@ saved_queries:
</File>
<TabItem value="Dimensions">
<File name='models/semantic_models.yml'>
```yml
semantic_models:
- name: semantic_model
...
dimensions:
- name: order_date
config:
meta: {<dictionary>}
```
</File>
</TabItem>
</Tabs>
Expand Down Expand Up @@ -343,3 +360,38 @@ models:

</File>

### Assign owner and additional metadata to dimensions

The following example shows how to assign a `data_owner` and additional metadata value to a dimension in a semantic model.

<File name='semantic_model.yml'>

```yml
semantic_models:
- name: semantic_model
...
dimensions:
- name: order_date
meta:
data_owner: "Finance team"
used_in_reporting: true
```

</File>

This second example shows how to assign a `data_owner` and additional metadata value to a dimension in the `dbt_project.yml` file using the `+meta` syntax.

<File name='dbt_project.yml'>

```yml
semantic-models:
jaffle_shop:
...
dimensions:
- name: order_date
+meta:
data_owner: "Finance team"
used_in_reporting: true
```

</File>

0 comments on commit 3571c0f

Please sign in to comment.