Skip to content

Commit

Permalink
udpate examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Dec 16, 2024
1 parent 643eebc commit b14f2ad
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 7 deletions.
8 changes: 4 additions & 4 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,15 +117,15 @@ 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
```
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
13 changes: 13 additions & 0 deletions website/docs/reference/resource-configs/enabled.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ snapshots:

</File>

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

```yaml
version: 2

snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
enabled: true | false
```
</File>
<File name='snapshots/<filename>.sql'>
```sql
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
17 changes: 17 additions & 0 deletions website/docs/reference/resource-configs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ models:
```
</File>
In a `snapshots/snapshot_name.yml` file:

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

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

</File>
</VersionBlock>

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>
Expand Down

0 comments on commit b14f2ad

Please sign in to comment.