Skip to content

Commit

Permalink
Merge branch 'current' into mirnawong1-patch-5
Browse files Browse the repository at this point in the history
  • Loading branch information
Jstein77 authored Aug 7, 2023
2 parents 36b1140 + 10ee507 commit 8964e7b
Show file tree
Hide file tree
Showing 30 changed files with 283 additions and 296 deletions.
2 changes: 1 addition & 1 deletion website/docs/docs/build/jinja-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ from app_data.payments


### Using a macro from a package
A number of useful macros have also been grouped together into [packages](docs/build/packages) — our most popular package is [dbt-utils](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/).
A number of useful macros have also been grouped together into [packages](/docs/build/packages) — our most popular package is [dbt-utils](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/).

After installing a package into your project, you can use any of the macros in your own project — make sure you qualify the macro by prefixing it with the [package name](/reference/dbt-jinja-functions/project_name):

Expand Down
22 changes: 11 additions & 11 deletions website/docs/docs/build/metrics-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,33 +98,33 @@ metrics:
### Ratio metrics
[Ratio metrics](/docs/build/ratio) involve a numerator measure and a denominator measure. A `constraint` string can be applied, to both numerator and denominator, or applied separately to the numerator or denominator.
[Ratio metrics](/docs/build/ratio) involve a numerator metric and a denominator metric. A `constraint` string can be applied, to both numerator and denominator, or applied separately to the numerator or denominator.

```yaml
# Ratio Metric
metrics:
- name: cancellation_rate
owners:
- support@getdbt.com
# Ratio metrics create a ratio out of two measures.
# Define the measures from the semantic model as numerator or denominator
# Ratio metrics create a ratio out of two metrics.
# Define the metrics from the semantic manifest as numerator or denominator
type: ratio
type_params:
numerator: cancellations_usd
denominator: transaction_amount_usd
numerator: cancellations
denominator: transaction_amount
filter: | # add optional constraint string. This applies to both the numerator and denominator
{{ Dimension('customer__country') }} = 'MX'
- name: enterprise_cancellation_rate
owners:
- support@getdbt.com
# Ratio metrics create a ratio out of two measures.
# Define the measures from the semantic model as numerator or denominator
# Define the metrics from the semantic model as numerator or denominator
type: ratio
type_params:
numerator:
name: cancellations_usd
name: cancellations
filter: {{ Dimension('company__tier' )}} = 'enterprise' # constraint only applies to the numerator
denominator: transaction_amount_usd
denominator: transaction_amount
filter: | # add optional constraint string. This applies to both the numerator and denominator
{{ Dimension('customer__country') }} = 'MX'
```
Expand All @@ -142,9 +142,9 @@ metrics:
- name: cancellations
type: simple
type_params:
measure: cancellations_usd # Specify the measure you are creating a proxy for.
filter: |
{{ Dimension('order__value')}} > 100 and {{Dimension('user__acquisition')}}
measure: cancellations_usd # Specify the measure you are creating a proxy for.
filter: |
{{ Dimension('order__value')}} > 100 and {{Dimension('user__acquisition')}}
```

## Filters
Expand Down
2 changes: 1 addition & 1 deletion website/docs/docs/build/python-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ with upstream_python_model as (

:::caution

Referencing [ephemeral](docs/build/materializations#ephemeral) models is currently not supported (see [feature request](https://github.com/dbt-labs/dbt-core/issues/7288))
Referencing [ephemeral](/docs/build/materializations#ephemeral) models is currently not supported (see [feature request](https://github.com/dbt-labs/dbt-core/issues/7288))
:::

## Configuring Python models
Expand Down
30 changes: 16 additions & 14 deletions website/docs/docs/build/ratio-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Ratio
tags: [Metrics, Semantic Layer]
---

Ratio allows you to create a ratio between two measures. You simply specify a numerator and a denominator measure. Additionally, you can apply a dimensional filter to both the numerator and denominator using a constraint string when computing the metric.
Ratio allows you to create a ratio between two metrics. You simply specify a numerator and a denominator metric. Additionally, you can apply a dimensional filter to both the numerator and denominator using a constraint string when computing the metric.

The following displays the full spec for ratio metrics, along with an example:

Expand All @@ -17,26 +17,28 @@ metrics:
type: ratio # Required
label: The value that will be displayed in downstream tools #Required
type_params: # Required
numerator: the measure used for the numerator # Required
filter: filter for the numerator# Optional
alias: alias for the numerator # Optional
denominator: the measure used for the denominator # Required
filter: filter for the denominator # Optional
alias: alias for the denominator # Optional
numerator: the name of the metric used for the numerator, or a struct of properties as below # Required
name: name of metric used for the numerator # Required
filter: filter for the numerator# Optional
alias: alias for the numerator # Optional
denominator: the name of the metric used for the denominator, or a struct of properties as below # Required
name: name of metric used for the denominator # Required
filter: filter for the denominator # Optional
alias: alias for the denominator # Optional
```
## Ratio metrics example
```yaml
# Ratio Metric
metrics:
- name: food_order_total_pct
description: "The food order total as the % of the total order"
label: Food Order Total %
- name: food_order_pct
description: "The food order count as a ratio of the total order count"
label: Food Order Ratio
type: ratio
type_params:
numerator: food_order_total
denominator: order_total
numerator: food_orders
denominator: orders

```
## Ratio metrics using different semantic models
Expand Down Expand Up @@ -90,7 +92,7 @@ on

## Add filter

Users can define constraints on input measures for a metric by applying a filter directly to the measure, like so:
Users can define constraints on input metrics for a ratio metric by applying a filter directly to the input metric, like so:

```yaml
metrics:
Expand All @@ -108,4 +110,4 @@ metrics:
name: distinct_purchasers
```
Note the `filter` and `alias` parameters for the measure referenced in the numerator. Use the `filter` parameter to apply a filter to the measure it's attached to. The `alias` parameter is used to avoid naming conflicts in the rendered SQL queries when the same measure is used with different filters. If there are no naming conflicts, the `alias` parameter can be left out.
Note the `filter` and `alias` parameters for the metric referenced in the numerator. Use the `filter` parameter to apply a filter to the metric it's attached to. The `alias` parameter is used to avoid naming conflicts in the rendered SQL queries when the same metric is used with different filters. If there are no naming conflicts, the `alias` parameter can be left out.
2 changes: 1 addition & 1 deletion website/docs/docs/cloud/git/connect-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ If you are your GitHub organization owner, you can also configure the dbt Cloud

## Personally authenticate with GitHub

Once the dbt Cloud admin has [set up a connection](docs/cloud/git/connect-github#installing-dbt-cloud-in-your-github-account) to your organization GitHub account, you need to personally authenticate, which improves the security of dbt Cloud by enabling you to log in using OAuth through GitHub.
Once the dbt Cloud admin has [set up a connection](/docs/cloud/git/connect-github#installing-dbt-cloud-in-your-github-account) to your organization GitHub account, you need to personally authenticate, which improves the security of dbt Cloud by enabling you to log in using OAuth through GitHub.
:::infoGitHub profile connection
- dbt Cloud developers on the [Enterprise plan](https://www.getdbt.com/pricing/) must each connect their GitHub profiles to dbt Cloud. This is because the dbt Cloud IDE verifies every developer's read / write access for the dbt repo.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/docs/collaborate/govern/model-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Any model meeting the criteria described above _can_ define a contract. We recom

A model's contract defines the **shape** of the returned dataset. If the model's logic or input data doesn't conform to that shape, the model does not build.

[Tests](docs/build/tests) are a more flexible mechanism for validating the content of your model _after_ it's built. So long as you can write the query, you can run the test. Tests are more configurable, such as with [custom severity thresholds](/reference/resource-configs/severity). They are easier to debug after finding failures, because you can query the already-built model, or [store the failing records in the data warehouse](/reference/resource-configs/store_failures).
[Tests](/docs/build/tests) are a more flexible mechanism for validating the content of your model _after_ it's built. So long as you can write the query, you can run the test. Tests are more configurable, such as with [custom severity thresholds](/reference/resource-configs/severity). They are easier to debug after finding failures, because you can query the already-built model, or [store the failing records in the data warehouse](/reference/resource-configs/store_failures).

In some cases, you can replace a test with its equivalent constraint. This has the advantage of guaranteeing the validation at build time, and it probably requires less compute (cost) in your data platform. The prerequisites for replacing a test with a constraint are:
- Making sure that your data platform can support and enforce the constraint that you need. Most platforms only enforce `not_null`.
Expand Down
4 changes: 4 additions & 0 deletions website/docs/docs/dbt-cloud-apis/sl-jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,7 @@ semantic_layer.query(metrics=['food_order_amount', 'order_gross_profit'],
- **What is the default output when adding granularity?**<br />
The default output follows the format `{time_dimension_name}__{granularity_level}`. So for example, if the time dimension name is `ds` and the granularity level is yearly, the output is `ds__year`.
## Related docs
- [dbt Semantic Layer integration best practices](/guides/dbt-ecosystem/sl-partner-integration-guide)
2 changes: 1 addition & 1 deletion website/docs/docs/deploy/ci-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you're interested in joining our beta, please fill out our Google Form to [si

## Set up CI jobs {#set-up-ci-jobs}

dbt Labs recommends that you create your CI job in a dedicated dbt Cloud [deployment environment](/docs/deploy/deploy-environments#create-a-deployment-environment) that's connected to a staging database. Having a separate environment dedicated for CI will provide better isolation between your temporary CI schema builds and your production data builds. Additionally, sometimes teams need their CI jobs to be triggered when a PR is made to a branch other than main. If your team maintains a staging branch as part of your release process, having a separate environment will allow you to set a [custom branch](/faqs/environments/custom-branch-settings) and, accordingly, the CI job in that dedicated environment will be triggered only when PRs are made to the specified custom branch.
dbt Labs recommends that you create your CI job in a dedicated dbt Cloud [deployment environment](/docs/deploy/deploy-environments#create-a-deployment-environment) that's connected to a staging database. Having a separate environment dedicated for CI will provide better isolation between your temporary CI schema builds and your production data builds. Additionally, sometimes teams need their CI jobs to be triggered when a PR is made to a branch other than main. If your team maintains a staging branch as part of your release process, having a separate environment will allow you to set a [custom branch](/faqs/environments/custom-branch-settings) and, accordingly, the CI job in that dedicated environment will be triggered only when PRs are made to the specified custom branch. To learn more, refer to [Get started with CI tests](/guides/orchestration/set-up-ci/overview).

<Tabs queryString="version">
<TabItem value="current" label="Current version" default>
Expand Down

This file was deleted.

Loading

0 comments on commit 8964e7b

Please sign in to comment.