Skip to content

Commit

Permalink
Merge branch 'current' into update-mf-joins
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Dec 23, 2024
2 parents 792dea2 + 702651b commit 832bb25
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 19 deletions.
2 changes: 1 addition & 1 deletion website/docs/docs/collaborate/govern/model-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This functionality is new in v1.5 — if you have thoughts, participate in [the

</VersionBlock>

import VersionsCallout from '/snippets/_version-callout.md';
import VersionsCallout from '/snippets/_model-version-callout.md';

<VersionsCallout />

Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/project-configs/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ required: True
keyword: project version, project versioning, dbt project versioning
---

import VersionsCallout from '/snippets/_version-callout.md';
import VersionsCallout from '/snippets/_model-version-callout.md';

<VersionsCallout />

Expand Down
9 changes: 4 additions & 5 deletions website/docs/reference/resource-configs/alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ seeds:

<TabItem value="snapshot" label="Snapshots">

Configure a snapshots's alias in your `dbt_project.yml` file or config block.
Configure a snapshots's alias in your `dbt_project.yml` file, `snapshots/snapshot_name.yml` file, or config block.

The following examples demonstrate how to `alias` a snapshot named `your_snapshot` to `the_best_snapshot`.

Expand All @@ -117,18 +117,17 @@ snapshots:
```
</File>

In the `snapshots/properties.yml` file:
In the `snapshots/snapshot_name.yml` file:

<File name='snapshots/properties.yml'>
<File name='snapshots/snapshot_name.yml'>

```yml
version: 2
snapshots:
- name: your_snapshot
- name: your_snapshot_name
config:
alias: the_best_snapshot
```
</File>
In `snapshots/your_snapshot.sql` file:
Expand Down
2 changes: 0 additions & 2 deletions website/docs/reference/resource-configs/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ default_value: {enforced: false}
id: "contract"
---

Supported in dbt v1.5 and higher.

When the `contract` configuration is enforced, dbt will ensure that your model's returned dataset exactly matches the attributes you have defined in yaml:
- `name` and `data_type` for every column
- Additional [`constraints`](/reference/resource-properties/constraints), as supported for this materialization and data platform
Expand Down
17 changes: 16 additions & 1 deletion website/docs/reference/resource-configs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ models:
```
</File>
This would result in the generated relation being located in the `reporting` database, so the full relation name would be `reporting.finance.sales_metrics` instead of the default target database.
</TabItem>

Expand Down Expand Up @@ -55,7 +56,7 @@ Available for dbt Cloud release tracks or dbt Core v1.9+. Select v1.9 or newer f

<VersionBlock firstVersion="1.9">

Specify a custom database for a snapshot in your `dbt_project.yml` or config file.
Specify a custom database for a snapshot in your `dbt_project.yml`, snapshot.yml file, or config file.

For example, if you have a snapshot that you want to load into a database other than the target database, you can configure it like this:

Expand All @@ -69,6 +70,20 @@ snapshots:
```
</File>

Or in a `snapshot_name.yml` file:

<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2
snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
database: snapshots
```
</File>

This results in the generated relation being located in the `snapshots` database so the full relation name would be `snapshots.finance.your_snapshot` instead of the default target database.

</VersionBlock>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_value: {NULL}
id: "dbt_valid_to_current"
---

Available from dbt v1.9 or with [the dbt Cloud "Latest" release track](/docs/dbt-versions/cloud-release-tracks) dbt Cloud.
<VersionCallout version="1.9" />

<File name='snapshots/schema.yml'>

Expand Down
22 changes: 20 additions & 2 deletions website/docs/reference/resource-configs/enabled.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,28 @@ snapshots:

</File>

<VersionBlock firstVersion="1.9">

<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2

snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
enabled: true | false
```
</File>
</VersionBlock>
<File name='snapshots/<filename>.sql'>
```sql
# Configuring in a SQL file is a legacy method and not recommended. Use the YAML file instead.

{% snapshot [snapshot_name](snapshot_name) %}

{{ config(
Expand All @@ -90,11 +109,10 @@ snapshots:
select ...

{% endsnapshot %}

```

</File>


</TabItem>

<TabItem value="tests">
Expand Down
15 changes: 15 additions & 0 deletions website/docs/reference/resource-configs/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ snapshots:
</File>
<VersionBlock firstVersion="1.9">
<File name='snapshots/properties.yml'>
```yaml
version: 2

snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
group: GROUP_NAME
```
</File>
</VersionBlock>
<File name='snapshots/<filename>.sql'>
```sql
Expand Down
17 changes: 17 additions & 0 deletions website/docs/reference/resource-configs/persist_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ snapshots:

</File>

<VersionBlock firstVersion="1.9">
<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2

snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
persist_docs:
relation: true
columns: true
```
</File>
</VersionBlock>
<File name='snapshots/<filename>.sql'>
```sql
Expand Down
33 changes: 28 additions & 5 deletions website/docs/reference/resource-configs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ models:
```
</File>
This would result in the generated relations for these models being located in the `marketing` schema, so the full relation names would be `analytics.target_schema_marketing.model_name`. This is because the schema of the relation is `{{ target.schema }}_{{ schema }}`. The [definition](#definition) section explains this in more detail.

</TabItem>

<TabItem value="seeds" label="Seeds">

Configure a custom schema in your `dbt_project.yml` file.
Configure a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) in your `dbt_project.yml` file.

For example, if you have a seed that should be placed in a separate schema called `mappings`, you can configure it like this:

Expand All @@ -50,16 +51,18 @@ This would result in the generated relation being located in the `mappings` sche

<VersionBlock lastVersion="1.8">

Available in dbt Core v1.9+. Select v1.9 or newer from the version dropdown to view the configs. Try it now in the [dbt Cloud "Latest" release track](/docs/dbt-versions/cloud-release-tracks).
Available in dbt Core v1.9 and higher. Select v1.9 or newer from the version dropdown to view the configs. Try it now in the [dbt Cloud "Latest" release track](/docs/dbt-versions/cloud-release-tracks).

</VersionBlock>

<VersionBlock firstVersion="1.9">

Specify a custom schema for a snapshot in your `dbt_project.yml` or config file.
Specify a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) for a snapshot in your `dbt_project.yml` or YAML file.

For example, if you have a snapshot that you want to load into a schema other than the target schema, you can configure it like this:

In a `dbt_project.yml` file:

<File name='dbt_project.yml'>

```yml
Expand All @@ -70,6 +73,21 @@ snapshots:
```
</File>

In a `snapshots/snapshot_name.yml` file:

<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2
snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
schema: snapshots
```

</File>

This results in the generated relation being located in the `snapshots` schema so the full relation name would be `analytics.snapshots.your_snapshot` instead of the default target schema.

</VersionBlock>
Expand All @@ -78,20 +96,25 @@ This results in the generated relation being located in the `snapshots` schema s

<TabItem value="saved-queries" label="Saved queries">

Specify a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) for a [saved query](/docs/build/saved-queries#parameters) in your `dbt_project.yml` or YAML file.

<File name='dbt_project.yml'>
```yml
saved-queries:
+schema: metrics
```
</File>

This would result in the saved query being stored in the `metrics` schema.

</TabItem>

<TabItem value="tests" label="Test">

Customize the schema for storing test results in your `dbt_project.yml` file.
Customize a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) for storing test results in your `dbt_project.yml` file.

For example, to save test results in a specific schema, you can configure it like this:


<File name='dbt_project.yml'>

```yml
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/resource-properties/versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ required: no
keyword: governance, model version, model versioning, dbt model versioning
---

import VersionsCallout from '/snippets/_version-callout.md';
import VersionsCallout from '/snippets/_model-version-callout.md';

<VersionsCallout />

Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions website/src/components/versionCallout/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import Admonition from '@theme/Admonition';

const VersionCallout = ({ version }) => {
if (!version) {
return null;
}

return (
<div>
<Admonition type="tip" icon="💡" title="Did you know...">
<span>
Available from dbt v{version} or with the{' '}
<a href="/docs/dbt-versions/cloud-release-tracks">
dbt Cloud "Latest" release track
</a>{' '}.
</span>
</Admonition>
</div>
);
};

export default VersionCallout;
2 changes: 2 additions & 0 deletions website/src/theme/MDXComponents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import Lifecycle from '@site/src/components/lifeCycle';
import DetailsToggle from '@site/src/components/detailsToggle';
import Expandable from '@site/src/components/expandable';
import ConfettiTrigger from '@site/src/components/confetti/';
import VersionCallout from '@site/src/components/versionCallout';

const MDXComponents = {
Head,
Expand Down Expand Up @@ -97,5 +98,6 @@ const MDXComponents = {
Expandable: Expandable,
ConfettiTrigger: ConfettiTrigger,
SortableTable: SortableTable,
VersionCallout: VersionCallout,
};
export default MDXComponents;

0 comments on commit 832bb25

Please sign in to comment.