Skip to content

Commit

Permalink
Merge branch 'current' into patch-7
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db authored May 10, 2024
2 parents c0c2ee4 + 59a4cd6 commit 33f6406
Show file tree
Hide file tree
Showing 18 changed files with 383 additions and 55 deletions.
51 changes: 26 additions & 25 deletions website/docs/docs/build/saved-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ saved_queries:
cache:
enabled: true # Or false if you want it disabled by default
query_params:
metrics:
- simple_metric
group_by:
- "Dimension('user__ds')"
where:
- "{{ Dimension('user__ds', 'DAY') }} <= now()"
- "{{ Dimension('user__ds', 'DAY') }} >= '2023-01-01'"
metrics:
- simple_metric
group_by:
- "Dimension('user__ds')"
where:
- "{{ Dimension('user__ds', 'DAY') }} <= now()"
- "{{ Dimension('user__ds', 'DAY') }} >= '2023-01-01'"
exports:
- name: my_export
config:
alias: my_export_alias
export_as: table
schema: my_export_schema_name
- name: my_export
config:
alias: my_export_alias
export_as: table
schema: my_export_schema_name
```
</File>
</VersionBlock>
</VersionBlock>
<!-- For versions 1.7 and lower-->
<VersionBlock lastVersion="1.7">
Expand All @@ -65,20 +65,21 @@ saved_queries:
description: "{{ doc('saved_query_description') }}"
label: Test saved query
query_params:
metrics:
- simple_metric
group_by:
- "Dimension('user__ds')"
where:
- "{{ Dimension('user__ds', 'DAY') }} <= now()"
- "{{ Dimension('user__ds', 'DAY') }} >= '2023-01-01'"
metrics:
- simple_metric
group_by:
- "Dimension('user__ds')"
where:
- "{{ Dimension('user__ds', 'DAY') }} <= now()"
- "{{ Dimension('user__ds', 'DAY') }} >= '2023-01-01'"
exports:
- name: my_export
config:
alias: my_export_alias
export_as: table
schema: my_export_schema_name
- name: my_export
config:
alias: my_export_alias
export_as: table
schema: my_export_schema_name
```
</File>
</VersionBlock>
Expand Down
17 changes: 16 additions & 1 deletion website/docs/docs/build/unit-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ You should unit test a model:
- Prior to refactoring the transformation logic (especially if the refactor is significant).
- Models with high "criticality" (public, contracted models or models directly upstream of an exposure).

### When to run unit tests

dbt Labs strongly recommends only running unit tests in development or CI environments. Since the inputs of the unit tests are static, there's no need to use additional compute cycles running them in production. Use them in development for a test-driven approach and CI to ensure changes don't break them.

Use the [resource type](/reference/global-configs/resource-type) flag `--exclude-resource-type` or the `DBT_EXCLUDE_RESOURCE_TYPE` environment variable to exclude unit tests from your production builds and save compute.

## Unit testing a model

This example creates a new `dim_customers` model with a field `is_valid_email_address` that calculates whether or not the customer’s email is valid:
Expand Down Expand Up @@ -293,7 +299,16 @@ unit_tests:
- {id: 1, first_name: emily}
```
## Known limitations
## Unit test exit codes
Unit test successes and failures are represented by two exit codes:
- Pass (0)
- Fail (1)
Exit codes differ from data test success and failure outputs because they don't directly reflect failing data tests. Data tests are queries designed to check specific conditions in your data, and they return one row per failed test case (for example, the number of values with duplicates for the `unique` test). dbt reports the number of failing records as failures. Whereas, each unit test represents one 'test case', so results are always 0 (pass) or 1 (fail) regardless of how many records failed within that test case.

Learn about [exit codes](/reference/exit-codes) for more information.


## Additional resources
Expand Down
4 changes: 2 additions & 2 deletions website/docs/docs/cloud/cloud-cli-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ dbt commands are run against dbt Cloud's infrastructure and benefit from:
<Lightbox src="/img/docs/dbt-cloud/cloud-cli-overview.jpg" title="Diagram of how the dbt Cloud CLI works with dbt Cloud's infrastructure to run dbt commands from your local command line." />

## Prerequisites
The dbt Cloud CLI is available in all [deployment regions](/docs/cloud/about-cloud/access-regions-ip-addresses) and for both multi-tenant and single-tenant accounts (Azure single-tenant not supported at this time).
The dbt Cloud CLI is available in all [deployment regions](/docs/cloud/about-cloud/access-regions-ip-addresses) and for both multi-tenant and single-tenant accounts.

- Ensure you are using dbt version 1.5 or higher. Refer to [dbt Cloud versions](/docs/dbt-versions/upgrade-dbt-version-in-cloud) to upgrade.
- You are on dbt version 1.5 or higher. Alternatively, set it to [Keep on latest version](/docs/dbt-versions/upgrade-dbt-version-in-cloud#keep-on-latest-version) to always use the latest version.

## Install dbt Cloud CLI

Expand Down
18 changes: 9 additions & 9 deletions website/docs/docs/cloud/dbt-cloud-ide/keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ Use this dbt Cloud IDE page to help you quickly reference some common operation

| Shortcut description | macOS | Windows |
|--------|----------------|------------------|
| View a full list of editor shortcuts | Fn-F1 | Fn-F1 |
| Select a file to open | Command-O | Control-O |
| Close currently active editor tab | Option-W | Alt-W |
| Preview code | Command-Enter | Control-Enter |
| Compile code | Command-Shift-Enter | Control-Shift-Enter |
| Reveal a list of dbt functions in the editor | Enter two underscores `__` | Enter two underscores `__` |
| Open the command palette to invoke dbt commands and actions | Command-P / Command-Shift-P | Control-P / Control-Shift-P |
| Multi-edit in the editor by selecting multiple lines | Option-Click / Shift-Option-Command / Shift-Option-Click | Hold Alt and Click |
| View the full list of editor shortcuts to help your development, such as adding a line comment, changing tab display size, building modified models, changing editor font size, and more. | Fn-F1 | Fn-F1 |
| Select a file to open. | Command-O | Control-O |
| Close the currently active editor tab. | Option-W | Alt-W |
| Preview code. | Command-Enter | Control-Enter |
| Compile code. | Command-Shift-Enter | Control-Shift-Enter |
| Reveal a list of dbt functions in the editor. | Enter two underscores `__` | Enter two underscores `__` |
| Open the command palette to invoke dbt commands and actions. | Command-P / Command-Shift-P | Control-P / Control-Shift-P |
| Multi-edit in the editor by selecting multiple lines. | Option-Click / Shift-Option-Command / Shift-Option-Click | Hold Alt and Click |
| Open the [**Invocation History Drawer**](/docs/cloud/dbt-cloud-ide/ide-user-interface#invocation-history) located at the bottom of the IDE. | Control-backtick (or Control + `) | Control-backtick (or Ctrl + `) |
| Add a block comment to the selected code. SQL files will use the Jinja syntax `({# #})` rather than the SQL one `(/* */)`.<br /> <br /> Markdown files will use the Markdown syntax `(<!-- -->)` | Command-Option-/ | Control-Alt-/ |
| Add a block comment to the selected code. SQL files will use the Jinja syntax `({# #})` rather than the SQL one `(/* */)`.<br /> <br /> Markdown files will use the Markdown syntax `(<!-- -->)`. | Command-Option-/ | Control-Alt-/ |

## Related docs

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Upgrading to v1.8"
title: "Upgrading to v1.8 (latest)"
id: upgrading-to-v1.8
description: New features and changes in dbt Core v1.8
displayed_sidebar: "docs"
Expand Down Expand Up @@ -78,6 +78,20 @@ models:

The [`run`](/reference/commands/run#the-`--empty`-flag) and [`build`](/reference/commands/build#the---empty-flag) commands now support the `--empty` flag for building schema-only dry runs. The `--empty` flag limits the refs and sources to zero rows. dbt will still execute the model SQL against the target data warehouse but will avoid expensive reads of input data. This validates dependencies and ensures your models will build properly.

### Deprecated functionality

The ability for installed packages to override built-in materializations without explicit opt-in from the user is being deprecated.

- Overriding a built-in materialization from an installed package raises a deprecation warning.
- Using a custom materialization from an installed package does not raise a deprecation warning.
- Using a built-in materialization package override from the root project via a wrapping materialization is still supported. For example:

```sql
{% materialization view, default %}
{{ return(my_cool_package.materialization_view_default()) }}
{% endmaterialization %}
```

### Managing changes to legacy behaviors

dbt Core v1.8 has introduced flags for [managing changes to legacy behaviors](/reference/global-configs/legacy-behaviors). You may opt into recently introduced changes (disabled by default), or opt out of mature changes (enabled by default), by setting `True` / `False` values, respectively, for `flags` in `dbt_project.yml`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Upgrading to v1.7 (latest)"
title: "Upgrading to v1.7"
id: upgrading-to-v1.7
description: New features and changes in dbt Core v1.7
displayed_sidebar: "docs"
Expand Down Expand Up @@ -30,6 +30,7 @@ This is a relatively small behavior change, but worth calling out in case you no

Beginning with v1.7, running [`dbt deps`](/reference/commands/deps) creates or updates the `package-lock.yml` file in the _project_root_ where `packages.yml` is recorded. The `package-lock.yml` file contains a record of all packages installed and, if subsequent `dbt deps` runs contain no updated packages in `dependencies.yml` or `packages.yml`, dbt-core installs from `package-lock.yml`.


## New and changed features and functionality

- [`dbt docs generate`](/reference/commands/cmd-docs) now supports `--select` to generate [catalog metadata](/reference/artifacts/catalog-json) for a subset of your project. Currently available for Snowflake and Postgres only, but other adapters are coming soon.
Expand Down Expand Up @@ -76,6 +77,20 @@ The run_results.json now includes three attributes related to the `applied` stat
- `compiled_code`: Rendered string of the code that was compiled (empty after parsing, but full string after compiling).
- `relation_name`: The fully-qualified name of the object that was (or will be) created/updated within the database.

### Deprecated functionality

The ability for installed packages to override built-in materializations without explicit opt-in from the user is being deprecated.

- Overriding a built-in materialization from an installed package raises a deprecation warning.
- Using a custom materialization from an installed package does not raise a deprecation warning.
- Using a built-in materialization package override from the root project via a wrapping materialization is still supported. For example:

```
{% materialization view, default %}
{{ return(my_cool_package.materialization_view_default()) }}
{% endmaterialization %}
```


### Quick hits

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ More consistency and flexibility around packages. Resources defined in a package
[**Project dependencies**](/docs/collaborate/govern/project-dependencies): Introduces `dependencies.yml` and dependent `projects` as a feature of dbt Cloud Enterprise. Allows enforcing model access (public vs. protected/private) across project/package boundaries. Enables cross-project `ref` of public models, without requiring the installation of upstream source code.
:::

### Deprecated functionality

The ability for installed packages to override built-in materializations without explicit opt-in from the user is being deprecated.

- Overriding a built-in materialization from an installed package raises a deprecation warning.
- Using a custom materialization from an installed package does not raise a deprecation warning.
- Using a built-in materialization package override from the root project via a wrapping materialization is still supported. For example:

```
{% materialization view, default %}
{{ return(my_cool_package.materialization_view_default()) }}
{% endmaterialization %}
```

### Quick hits

- [`state:unmodified` and `state:old`](/reference/node-selection/methods#the-state-method) for [MECE](https://en.wikipedia.org/wiki/MECE_principle) stateful selection
Expand Down
4 changes: 4 additions & 0 deletions website/docs/docs/dbt-versions/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Release notes are grouped by month. For customers using dbt Virtual Private Clou

## May 2024


- **Update**: The [dbt Cloud CLI](/docs/cloud/cloud-cli-installation) is now available for Azure single tenant and is accessible in all [deployment regions](/docs/cloud/about-cloud/access-regions-ip-addresses) for both multi-tenant and single-tenant accounts.
- **New**: The [dbt Semantic Layer](/docs/use-dbt-semantic-layer/dbt-sl) introduces [declarative caching](/docs/use-dbt-semantic-layer/sl-cache), allowing you to cache common queries to speed up performance and reduce query compute costs. Available for dbt Cloud Team or Enterprise accounts.

- <expandable alt_header="New: Keep on latest version" >

The **Keep on latest version** setting is now Generally Available (previously Public Preview).
Expand Down
18 changes: 15 additions & 3 deletions website/docs/docs/use-dbt-semantic-layer/dbt-sl.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,28 @@ plan="dbt Cloud Team or Enterprise"
link="/docs/use-dbt-semantic-layer/setup-sl"
icon="dbt-bit"/>

<Card
title="Architecture"
body="Learn about the powerful components that make up the dbt Semantic Layer."
link="/docs/use-dbt-semantic-layer/sl-architecture"
icon="dbt-bit"/>

<Card
title="Write queries with exports"
body="Use exports to write commonly used queries directly within your data platform, on a schedule."
link="/docs/use-dbt-semantic-layer/exports"
icon="dbt-bit"/>

<Card
title="Architecture"
body="Learn about the powerful components that make up the dbt Semantic Layer."
link="/docs/use-dbt-semantic-layer/sl-architecture"
title="Cache common queries"
body="Leverage result caching and declarative caching for common queries to speed up performance and reduce query computation."
link="/docs/use-dbt-semantic-layer/sl-cache"
icon="dbt-bit"/>

<Card
title="dbt Semantic Layer FAQs"
body="Discover answers to frequently asked questions about the dbt Semantic Layer, such as availability, integrations, and more."
link="/docs/use-dbt-semantic-layer/sl-faqs"
icon="dbt-bit"/>

<Card
Expand Down
Loading

0 comments on commit 33f6406

Please sign in to comment.