Skip to content

Commit

Permalink
Merge branch 'current' into dt-img-optim
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn14 authored Nov 17, 2023
2 parents 3cdf8e1 + 740edfa commit abf45f6
Show file tree
Hide file tree
Showing 14 changed files with 295 additions and 169 deletions.
18 changes: 6 additions & 12 deletions website/docs/docs/build/measures.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ sidebar_label: "Measures"
tags: [Metrics, Semantic Layer]
---

Measures are aggregations performed on columns in your model. They can be used as final metrics or serve as building blocks for more complex metrics. Measures have several inputs, which are described in the following table along with their field types.

| Parameter | Description | Type |
| --------- | ----------- | ---- |
| [`name`](#name) | Provide a name for the measure, which must be unique and can't be repeated across all semantic models in your dbt project. | Required |
| [`description`](#description) | Describes the calculated measure. | Optional |
| [`agg`](#aggregation) | dbt supports aggregations such as `sum`, `min`, `max`, and more. Refer to [Aggregation](/docs/build/measures#aggregation) for the full list of supported aggregation types. | Required |
| [`expr`](#expr) | You can either reference an existing column in the table or use a SQL expression to create or derive a new one. | Optional |
| [`non_additive_dimension`](#non-additive-dimensions) | Non-additive dimensions can be specified for measures that cannot be aggregated over certain dimensions, such as bank account balances, to avoid producing incorrect results. | Optional |
| `agg_params` | specific aggregation properties such as a percentile. | Optional |
| `agg_time_dimension` | The time field. Defaults to the default agg time dimension for the semantic model. | Optional |
| `label` | How the metric appears in project docs and downstream integrations. | Required |
Measures are aggregations performed on columns in your model. They can be used as final metrics or serve as building blocks for more complex metrics.

Measures have several inputs, which are described in the following table along with their field types.

import MeasuresParameters from '/snippets/_sl-measures-parameters.md';

<MeasuresParameters />

## Measure spec

Expand Down
38 changes: 18 additions & 20 deletions website/docs/docs/build/semantic-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ The complete spec for semantic models is below:

```yaml
semantic_models:
- name: the_name_of_the_semantic_model ## Required
description: same as always ## Optional
model: ref('some_model') ## Required
defaults: ## Required
agg_time_dimension: dimension_name ## Required if the model contains dimensions
entities: ## Required
- see more information in entities
measures: ## Optional
- see more information in measures section
dimensions: ## Required
- see more information in dimensions section
- name: the_name_of_the_semantic_model ## Required
description: same as always ## Optional
model: ref('some_model') ## Required
default: ## Required
agg_time_dimension: dimension_name ## Required if the model contains dimensions
entities: ## Required
- see more information in entities
measures: ## Optional
- see more information in measures section
dimensions: ## Required
- see more information in dimensions section
primary_entity: >-
if the semantic model has no primary entity, then this property is required. #Optional if a primary entity exists, otherwise Required
```
Expand Down Expand Up @@ -230,16 +230,14 @@ For semantic models with a measure, you must have a [primary time group](/docs/b

### Measures

[Measures](/docs/build/measures) are aggregations applied to columns in your data model. They can be used as the foundational building blocks for more complex metrics, or be the final metric itself. Measures have various parameters which are listed in a table along with their descriptions and types.
[Measures](/docs/build/measures) are aggregations applied to columns in your data model. They can be used as the foundational building blocks for more complex metrics, or be the final metric itself.

Measures have various parameters which are listed in a table along with their descriptions and types.

import MeasuresParameters from '/snippets/_sl-measures-parameters.md';

<MeasuresParameters />

| Parameter | Description | Field type |
| --- | --- | --- |
| `name`| Provide a name for the measure, which must be unique and can't be repeated across all semantic models in your dbt project. | Required |
| `description` | Describes the calculated measure. | Optional |
| `agg` | dbt supports the following aggregations: `sum`, `max`, `min`, `count_distinct`, and `sum_boolean`. | Required |
| `expr` | You can either reference an existing column in the table or use a SQL expression to create or derive a new one. | Optional |
| `non_additive_dimension` | Non-additive dimensions can be specified for measures that cannot be aggregated over certain dimensions, such as bank account balances, to avoid producing incorrect results. | Optional |
| `create_metric` | You can create a metric directly from a measure with `create_metric: True` and specify its display name with create_metric_display_name. Default is false. | Optional |


import SetUpPages from '/snippets/_metrics-dependencies.md';
Expand Down
26 changes: 26 additions & 0 deletions website/docs/docs/collaborate/govern/model-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,32 @@ dbt.exceptions.AmbiguousAliasError: Compilation Error
We opted to use `generate_alias_name` for this functionality so that the logic remains accessible to end users, and could be reimplemented with custom logic.
:::

### Run a model with multiple versions

To run a model with multiple versions, you can use the [`--select` flag](/reference/node-selection/syntax). For example:

- Run all versions of `dim_customers`:

```bash
dbt run --select dim_customers # Run all versions of the model
```
- Run only version 2 of `dim_customers`:

You can use either of the following commands (both achieve the same result):

```bash
dbt run --select dim_customers.v2 # Run a specific version of the model
dbt run --select dim_customers_v2 # Alternative syntax for the specific version
```

- Run the latest version of `dim_customers` using the `--select` flag shorthand:

```bash
dbt run -s dim_customers version:latest # Run the latest version of the model
```

These commands provide flexibility in managing and executing different versions of a dbt model.

### Optimizing model versions

How you define each model version is completely up to you. While it's easy to start by copy-pasting from one model's SQL definition into another, you should think about _what actually is changing_ from one version to another.
Expand Down
4 changes: 2 additions & 2 deletions website/docs/docs/core/connect-data-platform/vertica-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ meta:
authors: 'Vertica (Former authors: Matthew Carter, Andy Regan, Andrew Hedengren)'
github_repo: 'vertica/dbt-vertica'
pypi_package: 'dbt-vertica'
min_core_version: 'v1.4.0 and newer'
min_core_version: 'v1.6.0 and newer'
cloud_support: 'Not Supported'
min_supported_version: 'Vertica 12.0.0'
min_supported_version: 'Vertica 23.4.0'
slack_channel_name: 'n/a'
slack_channel_link: 'https://www.getdbt.com/community/'
platform_name: 'Vertica'
Expand Down
Loading

0 comments on commit abf45f6

Please sign in to comment.